The exchange.GetOrder()
function is used to get the order information.
Query the order details according to the order number, and return the {@struct/Order Order} structure if the query succeeds, or return null if the query fails. {@struct/Order Order}, null value
exchange.GetOrder(orderId)
The orderId
parameter is used to specify the order to be queried.
The attribute Id
of the order {@struct/Order Order} structure of the FMZ platform consists of the exchange product code and the exchange original order ID, separated by English commas. For example, the attribute Id
format of the order of the spot trading pair ETH_USDT
of the OKX exchange is: ETH-USDT,1547130415509278720
.
The parameter orderId
passed in when calling the exchange.GetOrder()
function to query an order is consistent with the Id
property of the order {@struct/Order Order} structure.
orderId true string
function main(){
var id = exchange.Sell(1000, 1)
// Parameter id is the order number, you need to fill in the number of the order you want to query
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);
}
The exchange.GetOrder()
function is not supported by some exchanges. The AvgPrice
attribute in the {@struct/Order Order} structure of the return value is the average price of the transaction. Some exchanges do not support this field, and if they do not, it is set to 0.
If you are using an older version of the docker, the orderId
parameter of the exchange.GetOrder()
function may differ from the orderId
described in the current documentation.
Exchanges that do not support the exchange.GetOrder()
function:
Function Name | Unsupported Spot Exchanges | Unsupported Futures Exchanges |
---|---|---|
GetOrder | Zaif / Coincheck / Bitstamp | – |
{@struct/Order Order}, {@fun/Trade/exchange.GetOrders exchange.GetOrders}, {@fun/Trade/exchange.GetHistoryOrders exchange.GetHistoryOrders}
exchange.CancelOrder exchange.GetOrders