Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
AscendEx
Backpack
BigONE
Binance
Bitfinex
bitFlyer
Bitget
Bithumb
Bitstamp
Bybit
Coincheck
Coinone
CoinW
Crypto.com
DeepCoin
Deribit
DigiFinex
Gate
Gemini
HashKey
HitBTC
HTX
Korbit
Kraken
KuCoin
LBank
MEXC
OKX
Poloniex
Upbit
WEEX
WOO X
Zaif
Decentralized Exchanges (DEX)
Prediction Markets
Securities and Futures
On-chain & Custom

GateIO (Spot): Gate spot (Gate API v4), plus margin accounts (isolated and cross) and spot trading under a unified account. It connects with a Gate API Key (Access Key and Secret Key); with the Simulate box checked it connects to the Gate testnet.

Futures_GateIO (Futures): Gate USDT-margined perpetual and delivery contracts, coin-margined (BTC-settled) perpetual contracts, USD1-settled perpetual contracts, and USDT options (Gate API v4). It connects with a Gate API Key (Access Key and Secret Key); both classic and unified accounts are supported. With the Simulate box checked it connects to the Gate testnet.

Names and Configuration
exchange.GetName()TypeAliases
GateIOSpotGate.io
Futures_GateIOFutures—
FieldRequiredDefault
---
Access KeyYes—
Secret KeyYes—
SimulateNoUnchecked

Trading Pairs and Contract Codes
GateIO (Spot)

Pair examples: BTC_USDT, ETH_BTC

Pairs are written as BTC_USDT without a contract code; symbols with a contract suffix such as .swap are rejected (use a Futures_GateIO exchange object for contracts).

Futures_GateIO (Futures)

Pair examples: BTC_USDT, BTC_USD, BTC_USD1

The quote currency selects the contract family: BTC_USDT is USDT-margined, BTC_USD is coin-margined (Gate's BTC-settled contracts), and BTC_USD1 is a USD1-settled perpetual (perpetuals only, no delivery contracts; see exchange.GetMarkets() for the listed ones). Delivery contracts are USDT-margined.

Contract codeDescription
swapPerpetual contract (the default).
this_weekCurrent-week delivery contract (expiring within 7 days).
next_weekNext-week delivery contract (expiring in 7 to 14 days).
quarterQuarterly delivery contract (the earliest quarter-end expiry other than the two above).
next_quarterNext-quarter delivery contract.

Delivery contracts are picked by expiry among the contracts the exchange actually lists; a tier that is not listed is rejected.

Native contract code examples: BTC_USDT_20260807

Delivery contracts can also be given by their Gate native name, for example BTC_USDT.BTC_USDT_20260807.

Exchange-specific IO Commands
GateIO (Spot)
CommandArgumentsDescriptionReturns
trade_margin—Switch to the isolated margin account. Kept locally; subsequent orders carry account=margin.The command name itself.
trade_super_margin—Switch to the cross margin account. Kept locally; subsequent orders and queries carry account=cross_margin.The command name itself.
trade_normal—Switch back to the normal spot account (the default).The command name itself.
unifiedboolUnified (true) / classic (false) account. Detected automatically on the first private request when not set. Under a unified account, orders and queries use the unified account (account=unified), which takes precedence over the margin setting.Null also on success; check GetLastError() afterwards when needed.

For the common commands api, base and currency see exchange.IO.

Futures_GateIO (Futures)
CommandArgumentsDescriptionReturns
crossbool[, symbol]Cross (true) / isolated (false) margin; sends a request to the exchange. (more below the table)Null also on success; check GetLastError() afterwards when needed.
dualbool[, symbol]Hedge (true) / one-way (false) position mode; sends a request to the exchange. Set per settlement currency (USDT, BTC, USD1), perpetual contracts only.Null also on success; check GetLastError() afterwards when needed.
unifiedboolUnified (true) / classic (false) account. Detected automatically on the first private request when not set.Null also on success; check GetLastError() afterwards when needed.

The rest of the longer descriptions in the table:

  • cross: Gate expresses the margin mode through the leverage value, so switching resets leverage to 10x (10x isolated leverage; a 10x cross leverage limit for perpetuals); call exchange.SetMarginLevel() afterwards for another leverage. Not available for options.

For the common commands api, base and currency see exchange.IO.

Function Support
GateIO (Spot)

Not supported (the call fails with an error and returns null): exchange.ModifyConditionOrder.

Served through a fallback:

  • exchange.GetRecords: Native periods are 10s, 1m, 5m, 15m, 30m, 1h, 4h, 8h, 1d, 1w, 1M; other periods are synthesized by the docker.
Futures_GateIO (Futures)

No unsupported standard functions.

Served through a fallback:

  • exchange.GetRecords: Native periods are 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w, 1M; other periods are synthesized by the docker.

Margin, Account and Simulation
All exchange objects

Simulation: The Simulate box uses the Gate testnet (api-testnet.gateapi.io); it needs a testnet API key.

GateIO (Spot)

Account: The default is the normal spot account; exchange.IO("trade_margin") and exchange.IO("trade_super_margin") switch to the isolated and cross margin accounts. Whether the account is unified is detected on the first private request, or set with exchange.IO("unified", bool). Under the isolated margin account, exchange.GetAccount() and exchange.GetAssets() sum the balances of all isolated pairs (the same currency is added up).

Futures_GateIO (Futures)

Margin mode: Gate expresses the margin mode through the leverage value (leverage 0 means cross). exchange.SetMarginLevel() reads the contract's current mode before setting leverage and never changes cross/isolated: for a cross perpetual it adjusts the cross leverage limit; a cross delivery contract always has leverage 0. Switch cross/isolated with exchange.IO("cross", bool).

Position mode: Hedge mode is set per settlement currency and applies to perpetuals only; switch it with exchange.IO("dual", bool).

Account: Whether the account is unified is detected on the first private request, or set with exchange.IO("unified", bool). On a classic account, perpetuals, delivery contracts and options are separate wallets, and USDT-margined, coin-margined and USD1-settled are separate too: exchange.GetAccount() and exchange.GetAssets() return only the wallet of the current contract. On a unified account they return all currencies of the unified account.

Options
Futures_GateIO (Futures)

Gate USDT options are supported, and the result of exchange.GetMarkets() includes option contracts. If options are not enabled on the account, order and position queries return the exchange's error. Options do not support conditional orders, order amendment (exchange.ModifyOrder()) or exchange.SetMarginLevel(), and cross cannot switch their margin mode.

Option code examples: BTC_USDT-20261225-65000-C

Option codes are Gate native codes: underlying-expiry (YYYYMMDD)-strike-C/P, and the underlying in the code must match the pair. Set the pair to BTC_USDT; the full symbol looks like BTC_USDT.BTC_USDT-20261225-65000-C.

Notes
GateIO (Spot)
  • The amount of a market buy order is the quote-currency amount to spend; a market sell order is in base currency (sent as Gate's amount). Conditional orders that execute at market after triggering work the same way.
  • Market orders are submitted as fok (fill or kill) by default; override with time_in_force in the order's extra parameters.
  • exchange.GetHistoryOrders() needs a pair (the current pair when omitted); an empty string fails.
  • Conditional orders support take-profit and stop-loss only, not OCO; modifying a conditional order is not supported, cancel and recreate it instead. The order placed on trigger is a GTC limit order when an order price is given, otherwise an IOC market order; the trigger is valid for 30 days. exchange.GetHistoryConditionOrders() does not support the since argument (the exchange API cannot filter by time) and fails when it is given.
Futures_GateIO (Futures)
  • Order, position and trade amounts are contract counts (the minimum order size is the MinQty in exchange.GetMarkets(); some contracts accept fractional contracts); what one contract represents is the CtVal in exchange.GetMarkets(): some base currency for USDT-margined and USD1-settled contracts and options, 1 USD per contract for coin-margined contracts.
  • When the futures wallet of a settlement currency has never been opened (no funds transferred in; the exchange reports USER_NOT_FOUND), queries without a specific contract (such as exchange.GetPositions() and exchange.GetOrders() over the current contract family) treat that wallet as having no positions and no open orders; a query for a specific contract returns the exchange's error.
  • Market orders are sent with price 0 and ioc (how Gate futures express a market order).
  • exchange.GetHistoryOrders() needs a specific contract (the current contract when omitted); an empty string or a range fails. Delivery contracts do not support the since argument.
  • Conditional orders support take-profit and stop-loss only, not OCO, and trigger on the last traded price; the order placed on trigger is a limit order when an order price is given, otherwise a market order (price 0, ioc). exchange.ModifyConditionOrder() supports perpetuals only (amended in place); for delivery contracts cancel and recreate instead. Gate may refuse to amend take-profit/stop-loss orders placed through the API (error code 1077 APIOrderNotSupportUpdateTouchOrder); exchange.ModifyConditionOrder() then fails, and the order has to be cancelled (exchange.CancelConditionOrder()) and created again.
  • exchange.GetHistoryConditionOrders() does not support the since argument (the exchange API cannot filter by time) and fails when it is given.