根据订单号查询订单详情,查询成功返回{@struct/Order Order}结构,查询失败返回空值。
{@struct/Order Order}、空值
exchange.GetOrder(orderId)
```orderId```参数用于指定所要查询的订单。
FMZ平台的订单{@struct/Order Order}结构的属性```Id```由交易所品种代码和交易所原始订单Id组成,以英文逗号间隔。例如OKX交易所的现货交易对```ETH_USDT```订单的属性```Id```格式为:```ETH-USDT,1547130415509278720```。
调用```exchange.GetOrder()```函数查询订单时传入的参数```orderId```与订单{@struct/Order Order}结构的```Id```属性一致。
orderId
true
string
```javascript
function main(){
var id = exchange.Sell(1000, 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():
id = exchange.Sell(1000, 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() {
auto id = exchange.Sell(1000, 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);
}
部分交易所不支持exchange.GetOrder()
函数。 返回值{@struct/Order Order}结构中AvgPrice
属性为成交均价,有些交易所不支持该字段,不支持则设置为0。
如使用较旧版本的托管者,exchange.GetOrder()
函数的参数orderId
可能与当前文档中描述的orderId
有差别。
不支持exchange.GetOrder()
函数的交易所:
函数名 | 不支持的现货交易所 | 不支持的期货交易所 |
---|---|---|
GetOrder | Zaif / Coincheck / Bitstamp | – |
{@struct/Order Order}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetHistoryOrders exchange.GetHistoryOrders}
exchange.CancelOrder exchange.GetOrders