exchange.GetConditionOrders
exchange.GetConditionOrders() function is used to obtain 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.
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])rustfn 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]); } }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 the pending condition orders for a specified trading pair.
javascriptfunction 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) }pythondef main(): # Query the pending condition orders for the BTC_USDT trading pair orders = exchange.GetConditionOrders("BTC_USDT") Log("BTC_USDT pending condition orders:", orders)rustfn 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); }c++void main() { // Query the pending condition orders for the BTC_USDT trading pair auto orders = exchange.GetConditionOrders("BTC_USDT"); Log("BTC_USDT pending condition orders:", orders); }
Returns
| Type | Description |
| The The returned Order structure contains a |
Arguments
| Name | Type | Required | Description |
symbol | string | No | The For spot exchange objects, when the For futures exchange objects, when the |
See Also
Remarks
In the GetConditionOrders function, the use cases of the symbol parameter are summarized as follows:
| Exchange Object Category | symbol Parameter | Query Scope | Remarks |
|---|---|---|---|
| Spot | symbol parameter not passed | Query all spot trading pairs | Applicable to all call scenarios; if the exchange interface does not support it, an error is reported and a null value is returned, which will not be repeated below |
| Spot | Specify a trading instrument, with symbol parameter as: "BTC_USDT" | Query the specified BTC_USDT trading pair | For spot exchange objects, the format of the symbol parameter is: "BTC_USDT" |
| Futures | symbol parameter not passed | Query all trading instruments within the dimension range of the current trading pair and contract code | Assuming the current trading pair is BTC_USDT and the contract code is swap, this queries all USDT-margined perpetual contracts. Equivalent to calling GetConditionOrders("USDT.swap") |
| Futures | Specify a trading instrument, with symbol parameter as: "BTC_USDT.swap" | Query the specified BTC USDT-margined perpetual contract | For futures exchange objects, the format of the symbol parameter is: a combination of the trading pair and contract code defined by the FMZ platform, with the two separated by the character ".". |
| Futures | Specify a range of trading instruments, with symbol parameter as: "USDT.swap" | Query all USDT-margined perpetual contracts | - |
| Futures exchange supporting options | symbol parameter not passed | Query all option contracts within the dimension range of the current trading pair | Assuming the current trading pair is BTC_USDT and the contract is set to an option contract, such as a Binance option contract: BTC-240108-40000-C |
| Futures exchange supporting options | Specify a specific trading instrument | Query the specified option contract | For example, for the Binance futures exchange, the symbol parameter is: BTC_USDT.BTC-240108-40000-C |
| Futures exchange supporting options | Specify a range of trading instruments, with symbol parameter as: "USDT.option" | Query all USDT-margined option contracts | - |
In the GetConditionOrders function, the query dimension ranges of the futures exchange object are summarized as follows:
| symbol Parameter | Request Scope Definition | Remarks |
|---|---|---|
| USDT.swap | USDT-margined perpetual contract range. | For dimensions not supported by the exchange API interface, an error is reported and a null value is 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 unfinished conditional orders within the query scope or on the specified trading instrument, calling this function will return 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.