Order
Returned by exchange.GetOrder(), exchange.GetOrders() and similar: order ID, price, amount, filled amount, average price, status, type, offset, contract code and conditional order settings.
Attributes
| Name | Type | Description |
Info | object | Raw data returned by the exchange interface, this attribute is not available during backtesting. |
Symbol | string | The FMZ symbol, written as described in |
Id | string | Order ID. On most exchanges the order ID consists of the exchange symbol code and the exchange's original order ID, separated by an English comma. For example, the |
Price | number | Order price, note that this attribute for market orders may be 0 or -1. |
Amount | number | Order quantity, note that this attribute for market orders may be the amount value rather than the coin quantity. |
DealAmount | number | Filled quantity, if the exchange interface does not provide this data, it may be filled with 0. |
AvgPrice | number | Average filled price, note that some exchanges do not provide this data. When not provided and cannot be calculated, this attribute is set to 0. |
Status | number | Order status, refer to |
Type | number | Order type, refer to |
Offset | number | Open/close direction for contract orders, refer to |
ContractType | string | For spot orders, this attribute is |
Condition | object | Trigger conditions and order prices of a conditional order, see |
Time | number | Order creation time, millisecond timestamp. |
See Also
Remarks
The Order structure can be returned by exchange.GetOrder() and exchange.GetOrders() functions. The exchange.GetOrders() function returns an array of Order structures. If there are no pending orders currently, it returns [], i.e., an empty array; if the call fails (network error, exchange error, etc.), it returns a null value (null in JavaScript, None in Python). The Status attribute of the Order structure can be directly compared with constants like ORDER_STATE_PENDING to determine if they are equal and thus confirm the order status.
For one-way position mode, when it cannot be determined whether an order is for closing (reducing) a position, the Offset field is set to the opening direction by default, i.e., ORDER_OFFSET_OPEN.
The Time field represents the order creation time as a millisecond timestamp. Some exchanges may also include time information in the Info field, but the Time field provides a standardized timestamp format.
Ordinary orders have no Condition field: in JavaScript reading it gives undefined; in Python the key is absent, so accessing order.Condition as an attribute raises AttributeError; use order.get("Condition") or "Condition" in order; in Rust the Order structure always has Condition, and for an ordinary order Condition.ConditionType is -1.