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

exchange.GetAccount

exchange.GetAccount()函数用于请求交易所账户信息。 GetAccount()函数是交易所对象{@var/EXCHANGE exchange}的成员函数,exchange对象的成员函数(方法)的用途只和exchange相关,文档之后不再赘述。

查询账户资产信息,查询成功返回{@struct/Account Account}结构,查询失败返回空值。 {@struct/Account Account}、空值

exchange.GetAccount()

function main(){
    // 鉴于测试代码,不使用商品期货策略一般架构,这里仅仅判断exchange.IO("status")函数,判断连接期货公司前置机成功后立即执行测试代码。股票证券无需使用exchange.IO("status")判断连接状态
    while (!exchange.IO("status")) {
        Sleep(1000)
    }
    
    // 获取账户资产信息,可以不用设置合约
    var account = exchange.GetAccount()
    Log("账户信息,Balance:", account.Balance, "FrozenBalance:", account.FrozenBalance, "Equity:", account.Equity, "UPnL:", account.UPnL)
}
def main():
    while not exchange.IO("status"):
        Sleep(1000)
    
    account = exchange.GetAccount()
    Log("账户信息,Balance", account["Balance"], "FrozenBalance:", account["FrozenBalance"], "Equity:", account["Equity"], "UPnL:", account["UPnL"])
void main() {
    while (exchange.IO("status") == 0) {
        Sleep(1000);
    }
    
    auto account = exchange.GetAccount();
    Log("账户信息,Balance", account.Balance, "FrozenBalance:", account.FrozenBalance, "Equity:", account.Equity, "UPnL:", account.UPnL);
}

获取当前账户信息。

{@struct/Account Account}

Trade exchange.GetName