Strategies KB.ZH
Strategies

GuoJian_First

liuguojian · javascript · Tools and Appendix · 2018-08-28 21:43:15

All strategies →

Context terms

Code summary Auto-extracted · not described by the author

Trading code: 4 functions, 0 classes; detected Entry.

Trading codeEntry

Detected terms

None

Operation terms

None

Code comments

  • No comments in English.

52 code lines · 4 functions · 0 classes · 2 parameters

Parameters

ParametersDefaultDescription
min0.0085买入最小值
max0.008534卖出最大值
Source code (52 lines)
/*backtest
start: 2018-08-27 00:00:00
end: 2018-08-28 20:00:00
period: 1m
exchanges: [{"eid":"Huobi","currency":"LTC_BTC"}]
*/

function main() {
    Log(max);
    Log(min);
    var a = 1;
    while(true){
        Log(exchange.GetAccount());
        var ticker = exchange.GetTicker();
        Log(ticker);
        if(ticker.High >= max){
            //Log("当前最高价"+ticker.High);
            //Log("将所有USDT换成BTC");
            Log("卖出1");
            exchange.Sell(-1, 1);
            Log(exchange.GetAccount());
            
        }
        if(ticker.Low <= min){
            Log("买入1");
            exchange.Buy(-1, 1);
            Log(exchange.GetAccount());
            break;
        }
        a++;
        Sleep(60000); // 一分钟
    }
    
}

function onexit(){
    Log("onexit");
}

function onerror(){
    Log("onerror");
}

function init(){
    Log("init");
}