Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Symbols
Failures and null values
Exchanges

Functions of exchange objects specify an instrument with the string parameter symbol. The notation is defined by the platform and does not depend on the exchange's own API notation, so this part of the code does not change when you switch exchanges.

Omitting symbol

Single-instrument functions (GetTicker, GetDepth, GetTrades, GetRecords, GetHistoryOrders, etc.) act on the **current instrument** when symbol is omitted: the current trading pair is set by exchange.SetCurrency (initially the pair configured for the live trading or backtest), and for futures the contract code is set by exchange.SetContractType. Multi-instrument queries use a range when symbol is omitted; see "Query ranges" below.

Trading pairs

A spot instrument is written as "BASE_QUOTE" in upper case, separated by an underscore _: BTC_USDT is BTC quoted in USDT, ETH_BTC is ETH quoted in BTC.

Contracts

On a futures exchange object an instrument is written as "pair.contractCode", separated by .:

NotationMeaning
BTC_USDT.swapBTC USDT-margined perpetual
BTC_USD.swapBTC coin-margined perpetual
BTC_USDT.quarterBTC USDT-margined quarterly contract
BTC_USD.this_weekBTC coin-margined weekly contract

The quote currency tells the margin type: stablecoins such as USDT and USDC mean USDT-margined (linear), USD means coin-margined (inverse). The common contract codes are swap (perpetual), this_week, next_week, quarter and next_quarter; which ones an exchange supports is described in exchange.SetContractType.

The default contract of a cryptocurrency futures exchange object is the perpetual swap: until exchange.SetContractType() is called, market and trading functions called without symbol act on the perpetual contract of the current trading pair.

Options

An option is written as "pair.optionCode", where the option code is the exchange's own notation. For example, the Futures_Binance (Binance Futures) option BTC-240108-40000-C is written BTC_USDT.BTC-240108-40000-C.

Native codes

Commodity futures and stock exchanges (Futures_CTP (CTP commodity futures), Futures_Futu (Futu), Futures_IB (Interactive Brokers)) have no "pair.contractCode" split: the instrument is the exchange's native contract code, for example rb2501 on CTP. Futu and Interactive Brokers codes may themselves contain . (for example 00700.HK); the whole string is one instrument and is not split.

Query ranges

GetOrders, GetPositions, GetConditionOrders and GetFundings can query many instruments at once. symbol may be a specific instrument or a range written as "quote.contractType":

symbolRange
USDT.swapUSDT-margined perpetuals
USDT.futuresUSDT-margined delivery contracts
USD.swapCoin-margined perpetuals
USD.futuresCoin-margined delivery contracts
USDT.optionUSDT-margined options
USD.optionCoin-margined options
USD.futures_comboSpread combos (Futures_Deribit inverse combos)
USD.futures_ffLinear delivery contracts (Futures_Kraken, contract codes ending in _ff)
USD.swap_pfLinear perpetuals (Futures_Kraken, contract code swap_pf)

Use the quote currency the exchange actually uses (for example USDC.swap). A range the exchange API does not support is reported as an error and returns a null value.

Default range when symbol is omitted or an empty string ""
  • Spot exchange objects: all instruments.
  • Cryptocurrency futures exchange objects: "current quote currency + contract type of the current contract". The type is futures_combo for a combo contract (a contract code containing a comma, such as quarter,swap, or a native Deribit combo code, such as BTC-FS-26DEC25_PERP), option for an option contract, swap_pf for swap_pf, futures_ff for codes ending in _ff, swap for other codes containing swap, and futures otherwise; with no contract set it is swap. For example, with the current instrument BTC_USDT.swap this equals passing USDT.swap; with BTC_USD.quarter it equals USD.futures; with BTC_USD.quarter,swap it equals USD.futures_combo.
  • Futures exchange objects without a "quote + contract type" split (Futures_CTP, Futures_Futu, Futures_IB, Futures_Polymarket): all instruments.
  • A few exchanges require an instrument in their query API; on these exchanges GetOrders and GetConditionOrders without symbol query only the current trading pair.

A successful query with no data in the range returns an empty array []; a failed call returns a null value, see Failures and null values. GetHistoryOrders and GetHistoryConditionOrders do not take ranges; without symbol they query the current instrument.