Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Obtains unfinished conditional orders (conditional orders that have not yet been triggered or canceled).

exchange.GetConditionOrders()
exchange.GetConditionOrders(symbol)

Examples

  • Use the spot exchange object to create multiple condition orders, then query the pending condition order information.

    javascript
    function main() { // Create multiple condition orders var condition1 = { ConditionType: ORDER_CONDITION_TYPE_TP, TpTriggerPrice: 65000, TpOrderPrice: 65000 } exchange.CreateConditionOrder("BTC_USDT", "sell", 0.01, condition1) var condition2 = { ConditionType: ORDER_CONDITION_TYPE_TP, TpTriggerPrice: 3200, TpOrderPrice: 3200 } exchange.CreateConditionOrder("ETH_USDT", "sell", 0.1, condition2) Sleep(1000) // Query all pending condition orders var orders = exchange.GetConditionOrders() Log("Pending condition orders count:", orders.length) for (var i = 0; i < orders.length; i++) { Log("Condition order", i+1, ":", orders[i]) } }
    python
    def main(): # Create multiple condition orders condition1 = { "ConditionType": ORDER_CONDITION_TYPE_TP, "TpTriggerPrice": 65000, "TpOrderPrice": 65000 } exchange.CreateConditionOrder("BTC_USDT", "sell", 0.01, condition1) condition2 = { "ConditionType": ORDER_CONDITION_TYPE_TP, "TpTriggerPrice": 3200, "TpOrderPrice": 3200 } exchange.CreateConditionOrder("ETH_USDT", "sell", 0.1, condition2) Sleep(1000) # Query all pending condition orders orders = exchange.GetConditionOrders() Log("Pending condition orders count:", len(orders)) for i in range(len(orders)): Log("Condition order", i+1, ":", orders[i])
    rust
    fn main() { // Create multiple condition orders let condition1 = OrderCondition { ConditionType: ORDER_CONDITION_TYPE_TP, TpTriggerPrice: 65000.0, TpOrderPrice: 65000.0, ..Default::default() }; let _ = exchange.CreateConditionOrder("BTC_USDT", "sell", 0.01, &condition1); let condition2 = OrderCondition { ConditionType: ORDER_CONDITION_TYPE_TP, TpTriggerPrice: 3200.0, TpOrderPrice: 3200.0, ..Default::default() }; let _ = exchange.CreateConditionOrder("ETH_USDT", "sell", 0.1, &condition2); Sleep(1000); // Query all pending condition orders let orders = exchange.GetConditionOrders(None).unwrap(); Log!("Pending condition orders count:", orders.len()); for i in 0..orders.len() { Log!("Condition order", i + 1, ":", orders[i]); } }
  • Query the pending condition orders for a specified trading pair.

    javascript
    function main() { // Query the pending condition orders for the BTC_USDT trading pair var orders = exchange.GetConditionOrders("BTC_USDT") Log("BTC_USDT pending condition orders:", orders) }
    python
    def main(): # Query the pending condition orders for the BTC_USDT trading pair orders = exchange.GetConditionOrders("BTC_USDT") Log("BTC_USDT pending condition orders:", orders)
    rust
    fn main() { // Query the pending condition orders for the BTC_USDT trading pair let orders = exchange.GetConditionOrders("BTC_USDT"); Log!("BTC_USDT pending condition orders:", orders); }

Returns

TypeDescription

Order array / null value

Order structure array on success; null value on failure.

The returned Order structure contains a Condition field, which contains the detailed configuration information of the conditional order (trigger price, execution price, condition type, etc.).

Arguments

NameTypeRequiredDescription

symbol

string

No

The instrument (for example BTC_USDT.swap) or range of instruments (for example USDT.swap) to query. If omitted or an empty string, a spot exchange object queries all instruments and a futures exchange object queries the range of the current quote currency and contract type (USDT.swap when the current instrument is BTC_USDT.swap). The full rules for ranges and the default range are described in Symbols.

See Also

Remarks

Range notation (USDT.swap, USD.futures, USDT.option, etc.) and the default range when symbol is omitted are described in Symbols; a range the exchange API does not support is reported as an error and returns a null value.

When the account represented by the exchange object exchange has no unfinished conditional orders within the query scope or on the specified trading instrument, calling this function will return an empty array, i.e.: [].

On a few exchanges the open conditional-order endpoint requires a symbol: there, calling without symbol only queries the open conditional orders of the current instrument, not the whole range. Which exchanges behave like this is noted on each exchange page (all exchanges are listed in Capability Matrix).

Support for the conditional order feature depends on the specific exchange; some exchanges may not support the conditional order feature.

Exchanges that do not support this function: Bithumb, Bitstamp, Coinw, DigiFinex, Futures_DigiFinex, Gemini, HashKey, Korbit, LBank, MEXC, Upbit, WEEX, Zaif, Hyperliquid, Pendle, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter, OKX_DEX, Futures_Polymarket, Futures_IB, Exchange, Web3. The call fails with an error and returns null; for all exchanges see Capability Matrix.