exchange.GetHistoryConditionOrders
The exchange.GetHistoryConditionOrders() function is used to retrieve the historical conditional orders (including triggered, canceled, and expired conditional orders) for the current trading pair or contract, and supports specifying a particular trading instrument.
exchange.GetHistoryConditionOrders()
exchange.GetHistoryConditionOrders(symbol)
exchange.GetHistoryConditionOrders(symbol, since)
exchange.GetHistoryConditionOrders(symbol, since, limit)
exchange.GetHistoryConditionOrders(since)
exchange.GetHistoryConditionOrders(since, limit)Examples
-
Query historical conditional orders. The returned results are sorted in ascending order by time.
javascriptfunction main() { var historyConditionOrders = exchange.GetHistoryConditionOrders() Log("Historical condition orders count:", historyConditionOrders.length) // Iterate and display; orders are sorted in ascending order by the Time property for (var i = 0; i < historyConditionOrders.length; i++) { Log("Order", i+1, "Created at:", historyConditionOrders[i].Time, "ID:", historyConditionOrders[i].Id, "Status:", historyConditionOrders[i].Status) } }pythondef main(): historyConditionOrders = exchange.GetHistoryConditionOrders() Log("Historical condition orders count:", len(historyConditionOrders)) # Iterate and display; orders are sorted in ascending order by the Time property for i in range(len(historyConditionOrders)): Log("Order", i+1, "Created at:", historyConditionOrders[i]["Time"], "ID:", historyConditionOrders[i]["Id"], "Status:", historyConditionOrders[i]["Status"])rustfn main() { let historyConditionOrders = exchange.GetHistoryConditionOrders(None, None, None).unwrap(); Log!("Historical condition orders count:", historyConditionOrders.len()); // Iterate and display; orders are sorted in ascending order by the Time property for i in 0..historyConditionOrders.len() { Log!("Order", i + 1, "Created at:", historyConditionOrders[i].Time, "ID:", historyConditionOrders[i].Id, "Status:", historyConditionOrders[i].Status); } }c++void main() { auto historyConditionOrders = exchange.GetHistoryConditionOrders(); Log("Historical condition orders count:", historyConditionOrders.size()); // Iterate and display; orders are sorted in ascending order by the Time property for (int i = 0; i < historyConditionOrders.size(); i++) { Log("Order", i+1, "Created at:", historyConditionOrders[i].Time, "ID:", historyConditionOrders[i].Id, "Status:", historyConditionOrders[i].Status); } } -
Query the historical conditional orders of a specified trading pair, and limit the number of results returned.
javascriptfunction main() { // Query the 10 most recent historical conditional orders for the BTC_USDT trading pair var historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10) Log("BTC_USDT historical condition orders:", historyConditionOrders) }pythondef main(): # Query the 10 most recent historical conditional orders for the BTC_USDT trading pair historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10) Log("BTC_USDT historical condition orders:", historyConditionOrders)rustfn main() { // Query the 10 most recent historical conditional orders for the BTC_USDT trading pair let historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10); Log!("BTC_USDT historical condition orders:", historyConditionOrders); }c++void main() { // Query the 10 most recent historical conditional orders for the BTC_USDT trading pair auto historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10); Log("BTC_USDT historical condition orders:", historyConditionOrders); } -
Query historical conditional orders by time range.
javascriptfunction main() { // Query historical conditional orders starting from the specified timestamp var startTime = new Date("2024-01-01").getTime() var historyConditionOrders = exchange.GetHistoryConditionOrders(startTime, 50) Log("Historical condition orders since:", historyConditionOrders) }pythondef main(): # Query historical conditional orders starting from the specified timestamp import time startTime = int(time.mktime(time.strptime("2024-01-01", "%Y-%m-%d")) * 1000) historyConditionOrders = exchange.GetHistoryConditionOrders(startTime, 50) Log("Historical condition orders since:", historyConditionOrders)rustfn main() { // Query historical conditional orders starting from the specified timestamp let startTime: i64 = 1704067200000; // Timestamp for 2024-01-01 // In Rust, passing None for the symbol parameter means the current trading pair let historyConditionOrders = exchange.GetHistoryConditionOrders(None, startTime, 50); Log!("Historical condition orders since:", historyConditionOrders); }c++void main() { // Query historical conditional orders starting from the specified timestamp auto startTime = 1704067200000; // Timestamp for 2024-01-01 // In C++, the symbol parameter cannot be omitted; pass "" to indicate the current trading pair auto historyConditionOrders = exchange.GetHistoryConditionOrders("", startTime, 50); Log("Historical condition orders since:", historyConditionOrders); }
Returns
| Type | Description |
| The The returned Order structure contains a |
Arguments
| Name | Type | Required | Description |
symbol | string | No | The If you are querying conditional order data for an options contract, set the |
since | number | No | The |
limit | number | No | The |
See Also
Remarks
-
When the
symbol,since, andlimitparameters are not specified, the historical conditional orders of the current trading pair or contract are queried by default, i.e., the historical conditional orders within a certain range closest to the current time are queried. The query range depends on the single-query range of the exchange interface. -
When the
symbolparameter is specified, the historical conditional orders of the set trading instrument are queried. -
When the
sinceparameter is specified, the query starts from thesincetimestamp and proceeds toward the current time. -
When the
limitparameter is specified, the query returns after a sufficient number of records has been found. -
This function is only supported by exchanges that provide a historical conditional order query interface.
Historical conditional orders include conditional orders in states such as triggered (converted to regular orders), canceled, and expired.
The returned array of historical conditional orders is sorted in ascending order by order creation time (the Time attribute), i.e., orders with the earliest time are at the front of the array, and orders with the latest time are at the back.
Support for the conditional order feature depends on the specific exchange. Some exchanges may not support the conditional order feature or the historical conditional order query feature.