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

Retrieves 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.

    javascript
    function 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) } }
    python
    def 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"])
    rust
    fn 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); } }
  • Query the historical conditional orders of a specified trading pair, and limit the number of results returned.

    javascript
    function 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) }
    python
    def 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)
    rust
    fn 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); }
  • Query historical conditional orders by time range.

    javascript
    function 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) }
    python
    def 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)
    rust
    fn 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); }

Returns

TypeDescription

Order array / null value

Array of Order structures on success; null value on failure.

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

Arguments

NameTypeRequiredDescription

symbol

string

No

Instrument code, for example BTC_USDT on a spot exchange object or BTC_USDT.swap on a futures exchange object; the notation (including options) is described in Symbols. If omitted, the historical condition orders of the current trading pair and contract code are queried.

since

number

No

Starting timestamp of the query, in milliseconds.

limit

number

No

Number of conditional orders to query.

See Also

Remarks

  • When the symbol, since, and limit parameters 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 symbol parameter is specified, the historical conditional orders of the set trading instrument are queried.

  • When the since parameter is specified, the query starts from the since timestamp and proceeds toward the current time.

  • When the limit parameter 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.

Exchanges that do not support this function: Bithumb, Bitstamp, Coincheck, Coinone, 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.