The resource loading... loading...

GuoJian_First

Author: liuguojian, Date: 2018-08-28 20:03:50
Tags: Tool


/*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");
}




    
 

Related

More