The resource loading... loading...

Examples of transaction terminal plugins

Author: Inventors quantify - small dreams, Date: 2020-02-29 16:54:07
Tags:

This is used to demonstrate the embedded functionality of the transaction terminal plugin.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