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

exchange.GetOrder

exchange.GetOrder()函数用于获取订单信息。

根据订单号查询订单详情,查询成功返回{@struct/Order Order}结构,查询失败返回空值。 {@struct/Order Order}、空值

exchange.GetOrder(orderId)

orderId参数用于指定所要查询的订单。 orderId true string

function main(){
    // 鉴于测试代码,不使用商品期货策略一般架构,这里仅仅判断exchange.IO("status")函数,判断连接期货公司前置机成功后立即执行测试代码。股票证券无需使用exchange.IO("status")判断连接状态
    while (!exchange.IO("status")) {
        Sleep(1000)
    }
    // 设置合约代码
    exchange.SetContractType("rb888")
    // 设置下单方向
    exchange.SetDirection("sell")
    
    // 下单价格只是举例,较大的价格不会成交,订单会处于订单薄中待成交状态,具体测试可以自行调整价格
    var id = exchange.Sell(99999, 1)
    // 参数id为订单号码,需填入你想要查询的订单的号码
    var order = exchange.GetOrder(id)      
    Log("Id:", order.Id, "Price:", order.Price, "Amount:", order.Amount, "DealAmount:",
        order.DealAmount, "Status:", order.Status, "Type:", order.Type)
}
def main():
    while not exchange.IO("status"):
        Sleep(1000)
    exchange.SetContractType("rb888")
    exchange.SetDirection("sell")
    
    id = exchange.Sell(99999, 1)
    order = exchange.GetOrder(id)
    Log("Id:", order["Id"], "Price:", order["Price"], "Amount:", order["Amount"], "DealAmount:", 
        order["DealAmount"], "Status:", order["Status"], "Type:", order["Type"])
void main() {
    while (exchange.IO("status") == 0) {
        Sleep(1000);
    }
    exchange.SetContractType("rb888");
    exchange.SetDirection("sell");
    
    auto id = exchange.Sell(99999, 1);
    auto order = exchange.GetOrder(id);
    Log("Id:", order.Id, "Price:", order.Price, "Amount:", order.Amount, "DealAmount:", 
        order.DealAmount, "Status:", order.Status, "Type:", order.Type);
}

根据具体订单Id查询订单详细信息。

返回值为{@struct/Order Order}结构。

{@struct/Order Order}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}

exchange.CancelOrder exchange.GetOrders