exchange.GetConditionOrders
The exchange.GetConditionOrders() function is used to get unfulfilled conditional orders (conditional orders that have not been triggered or canceled).
exchange.GetConditionOrders()
exchange.GetConditionOrders(symbol)Examples
-
Use a spot exchange object to create multiple condition orders and then query pending condition order information.
javascriptfunction 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]) } }pythondef 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])c++void main() { // Create multiple condition orders OrderCondition condition1 = {.ConditionType = ORDER_CONDITION_TYPE_TP, .TpTriggerPrice = 65000, .TpOrderPrice = 65000}; exchange.CreateConditionOrder("BTC_USDT", "sell", 0.01, condition1); OrderCondition 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 auto orders = exchange.GetConditionOrders(); Log("Pending condition orders count:", orders.size()); for (int i = 0; i < orders.size(); i++) { Log("Condition order", i+1, ":", orders[i]); } } -
Query pending condition orders for a specific trading pair.
javascriptfunction main() { // Query pending condition orders for BTC_USDT trading pair var orders = exchange.GetConditionOrders("BTC_USDT") Log("BTC_USDT pending condition orders:", orders) }pythondef main(): # Query pending condition orders for BTC_USDT trading pair orders = exchange.GetConditionOrders("BTC_USDT") Log("BTC_USDT pending condition orders:", orders)c++void main() { // Query pending condition orders for BTC_USDT trading pair auto orders = exchange.GetConditionOrders("BTC_USDT"); Log("BTC_USDT pending condition orders:", orders); }
Returns
| Type | Description |
| The |
Arguments
| Name | Type | Required | Description |
symbol | string | No | The parameter |
See Also
Remarks
Summary of usage scenarios for the symbol parameter in the GetConditionOrders function:
| Exchange Object Category | symbol Parameter | Query Range | Remarks |
|---|---|---|---|
| Spot | No symbol parameter passed | Query all spot trading pairs | For all calling scenarios, if the exchange interface does not support it, an error will be reported and null will be returned, which will not be repeated |
| Spot | Specify trading instrument, symbol parameter: "BTC_USDT" | Query the specified BTC_USDT trading pair | For spot exchange objects, the symbol parameter format is: "BTC_USDT" |
| Futures | No symbol parameter passed | Query all trading instruments within the current trading pair and contract code dimension range | If the current trading pair is BTC_USDT and the contract code is swap, it queries all USDT-margined perpetual contracts. Equivalent to calling GetConditionOrders("USDT.swap") |
| Futures | Specify trading instrument, symbol parameter: "BTC_USDT.swap" | Query the specified BTC USDT-margined perpetual contract | For futures exchange objects, the symbol parameter format is: a combination of trading pair and contract code defined by the FMZ platform, separated by the character "." |
| Futures | Specify trading instrument range, symbol parameter: "USDT.swap" | Query all USDT-margined perpetual contracts | - |
| Futures exchanges supporting options | No symbol parameter passed | Query all option contracts within the current trading pair dimension range | If the current trading pair is BTC_USDT and the contract is set to an option contract, e.g., Binance option contract: BTC-240108-40000-C |
| Futures exchanges supporting options | Specify specific trading instrument | Query the specified option contract | For example, for Binance Futures exchange, symbol parameter: BTC_USDT.BTC-240108-40000-C |
| Futures exchanges supporting options | Specify trading instrument range, symbol parameter: "USDT.option" | Query all USDT-margined option contracts | - |
Summary of query dimension ranges for futures exchange objects in the GetConditionOrders function:
| symbol Parameter | Request Range Definition | Remarks |
|---|---|---|
| USDT.swap | USDT-margined perpetual contract range | For dimensions not supported by the exchange API interface, an error will be reported and null will be returned when called |
| USDT.futures | USDT-margined delivery contract range | - |
| USD.swap | Coin-margined perpetual contract range | - |
| USD.futures | Coin-margined delivery contract range | - |
| USDT.option | USDT-margined option contract range | - |
| USD.option | Coin-margined option contract range | - |
| USDT.futures_combo | Spread combination contract range | Futures_Deribit exchange |
| USD.futures_ff | Mixed margin delivery contract range | Futures_Kraken exchange |
| USD.swap_pf | Mixed margin perpetual contract range | Futures_Kraken exchange |
When the account represented by the exchange object exchange has no unfulfilled conditional orders within the query range or for the specified trading instrument, calling this function returns an empty array, i.e., [].
Support for the conditional order feature depends on the specific exchange; some exchanges may not support the conditional order feature.