Condition
Conditional order settings: the conditional order type and the take-profit and stop-loss trigger and order prices, used to set the trigger conditions and execution prices of conditional orders.
Attributes
| Name | Type | Description |
ConditionType | number | Conditional order type, see |
TpTriggerPrice | number | Take profit trigger price. Used when the conditional order type is TP or OCO, the take profit order is triggered when the market price reaches this price. |
TpOrderPrice | number | Take profit order execution price, i.e., the actual order price after take profit is triggered. When placing the order, a price of -1 means execution as a market order; in conditional orders returned by queries, this price is usually 0 for market execution. |
SlTriggerPrice | number | Stop loss trigger price. Used when the conditional order type is SL or OCO, the stop loss order is triggered when the market price reaches this price. |
SlOrderPrice | number | Stop loss order execution price, i.e., the actual order price after stop loss is triggered. When placing the order, a price of -1 means execution as a market order; in conditional orders returned by queries, this price is usually 0 for market execution. |
See Also
Remarks
- OCO orders (ConditionType=
ORDER_CONDITION_TYPE_OCO) set both take profit and stop loss conditions simultaneously. When one condition is triggered, the other is automatically canceled. - TP orders (ConditionType=
ORDER_CONDITION_TYPE_TP) only use the TpTriggerPrice and TpOrderPrice fields. - SL orders (ConditionType=
ORDER_CONDITION_TYPE_SL) only use the SlTriggerPrice and SlOrderPrice fields. - GENERIC orders (ConditionType=
ORDER_CONDITION_TYPE_GENERIC) are generic conditional orders, and the specific fields used depend on the exchange implementation. In GENERIC orders returned by queries, the Tp* and Sl* field groups hold the same values (one trigger price and one order price). The GENERIC type only appears in query results;exchange.CreateConditionOrderandexchange.ModifyConditionOrderdo not support it and return a null value with an error logged.
Support for conditional order functionality depends on the specific exchange. Some exchanges may not support certain types of conditional orders.