exchange.GetHistoryConditionOrders
The exchange.GetHistoryConditionOrders() function is used to get historical conditional orders (including triggered, cancelled, and expired conditional orders) for the current trading pair and contract; supports specifying specific trading instruments.
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, results are returned 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 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 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"])c++void main() { auto historyConditionOrders = exchange.GetHistoryConditionOrders(); Log("Historical condition orders count:", historyConditionOrders.size()); // Iterate and display, orders are sorted in ascending order by 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 historical conditional orders for a specified trading pair with a limit on the number of results.
javascriptfunction main() { // Query the last 10 historical conditional orders for BTC_USDT trading pair var historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10) Log("BTC_USDT historical condition orders:", historyConditionOrders) }pythondef main(): # Query the last 10 historical conditional orders for BTC_USDT trading pair historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10) Log("BTC_USDT historical condition orders:", historyConditionOrders)c++void main() { // Query the last 10 historical conditional orders for BTC_USDT trading pair auto historyConditionOrders = exchange.GetHistoryConditionOrders("BTC_USDT", 0, 10); Log("BTC_USDT historical condition orders:", historyConditionOrders); } -
Query historical conditional orders based on a specified time range.
javascriptfunction main() { // Query historical conditional orders starting from a 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 a 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)c++void main() { // Query historical conditional orders starting from a specified timestamp auto startTime = 1704067200000; // Timestamp for 2024-01-01 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 querying conditional order data for option contracts, set the |
since | number | No | The |
limit | number | No | The |
See Also
Remarks
-
When
symbol,since, andlimitparameters are not specified, it defaults to querying historical conditional orders for the current trading pair and contract. It queries historical conditional orders within a certain range from the current time, with the query range determined by the exchange API's single query range. -
When the
symbolparameter is specified, it queries historical conditional orders for the specified trading instrument. -
When the
sinceparameter is specified, it queries from thesincetimestamp towards the current time. -
When the
limitparameter is specified, it returns after querying enough entries. -
This function only supports exchanges that provide historical conditional order query interfaces.
Historical conditional orders include: triggered (converted to regular orders), cancelled, expired, and other status conditional orders.
The returned historical conditional order array is sorted in ascending order by order creation time (Time attribute), i.e., the earliest orders are at the front of the array and the latest orders are at the back.
Conditional order functionality support depends on the specific exchange; some exchanges may not support conditional order functionality or historical conditional order query functionality.