统计收益 (复制)


创建日期: 2015-02-28 19:17:29 最后修改: 2015-02-28 19:17:29
复制: 4 点击次数: 1631
avatar of 总值约: 23938.37 元 总值约: 23938.37 元
0
关注
1
关注者

统计OK和Bitvc期货总收益;OK为主交易所;

策略源码
var okrights=0;
var vcright=0;
var InitRights=0;
var totalrights=0;
var profit=0;
var oldprofit=0;

SetErrorFilter("502:|503:|unexpected|network|timeout|WSARecv|Connect|GetAddr|no such|reset|http|received|EOF");



function Rights() {
        
        var accountok;
        var accountvc;
        while (!(accountok = exchanges[0].GetAccount())) {
            Sleep(500);
        }
        while (!(accountvc = exchanges[1].GetAccount())) {
            Sleep(500);
        }
        var objok;
        var objvc;
        
        objok=JSON.parse(exchanges[0].GetRawJSON());
        objvc=JSON.parse(exchanges[1].GetRawJSON());
        
        okrights=objok.info["btc"].rights;
        vcrights=objvc.dynamicRights;
        totalrights=okrights+vcrights;
        
        
}

function main(){
    Rights();
    InitRights=totalrights;
   Log("初始权益合计_BTC",InitRights);
   while(true){
    Rights();
    profit=totalrights-InitRights;
    if(profit!==oldprofit){
    LogProfit(profit,"BTC");
    oldprofit=profit;
    }
    Sleep(LXT*1000);
   }
   
 
}