Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
Built-in Variables and Constants
Conventions
Exchanges

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

NameTypeDescription

ConditionType

number

Conditional order type, see ORDER_CONDITION_TYPE: OCO (0), take-profit (1), stop-loss (2) or generic (3, only in query results).

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.CreateConditionOrder and exchange.ModifyConditionOrder do 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.