Order
Order structure.
Attributes
| Name | Type | Description |
Info | object | Raw data returned by the exchange interface, this attribute is not available during backtesting. |
Symbol | string | The
|
Id | string | Order ID, this attribute 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 | Conditional order configuration information. When the order is a conditional order, this field contains the trigger conditions and execution price configuration for the conditional order. For regular orders, this field is null. The structure of this field refers to the |
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 or an empty array. If there are no pending orders currently, it returns [], i.e., an empty array. 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.