资源加载中... loading...

交易终端插件范例

Author: 发明者量化-小小梦, Date: 2020-02-29 16:54:07
Tags:

用于演示交易终端插件嵌入功能。 https://www.fmz.com/api#交易插件


function main() {
    var initAcc = _C(exchange.GetAccount)
    var tbl = {
        "type" : "table", 
        "title" : "表格",
        "cols" : ["项目", "内容"],
        "rows" : [],     
    }
    
    for (var i = 0 ; i < TransactionTimes ; i++) {
        var info = null
        if (Side == 0) {
            info = $.Buy(Amount)
        } else if (Side == 1) {
            info = $.Sell(Amount)
        } else {
            throw "side error!"
        }
        
        tbl.rows.push([i + "号订单,成交情况:", JSON.stringify(info)])    
        Sleep(300)
    }
    
    var nowAcc = _C(exchange.GetAccount)
    delete initAcc.Info
    delete nowAcc.Info
    tbl.rows.push(["初始账户:", JSON.stringify(initAcc)])
    tbl.rows.push(["执行后账户:", JSON.stringify(nowAcc)])    
    return tbl
}

More