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

KuCoin (Spot): KuCoin spot trading; it connects to api.kucoin.com by default. It uses a KuCoin API Key and needs the Access Key, Secret Key and the passphrase set when the key was created. Balances come from the trading account (trade) only; assets in the funding account must be transferred to the trading account first. There is no account-switch command for margin orders; pass KuCoin's tradeType and similar fields in the order's extra parameters (merged into the request as is).

Futures_KuCoin (Futures): KuCoin futures: USDT- and USDC-margined perpetual contracts, plus coin-margined perpetual and delivery contracts; it connects to api-futures.kucoin.com by default. It uses a KuCoin API Key and needs the Access Key, Secret Key and the passphrase set when the key was created.

Names and Configuration
exchange.GetName()TypeAliases
KuCoinSpot—
Futures_KuCoinFuturesKuCoin Futures

✓ marks the exchange objects that have the field.

FieldKuCoinFutures_KuCoinRequiredDescription
Access Key✓✓Yes—
Secret Key✓✓Yes—
Password✓YesThe passphrase set when the API key was created.
Passphrase✓Yes—

Trading Pairs and Contract Codes
KuCoin (Spot)

Pair examples: BTC_USDT, ETH_BTC

Trading pairs are written BASE_QUOTE, matching KuCoin's BASE-QUOTE pairs; case-insensitive. Symbols with a contract suffix such as .swap are rejected (use a Futures_KuCoin exchange object for contracts).

Futures_KuCoin (Futures)

Pair examples: BTC_USDT, BTC_USDC, BTC_USD

The quote currency selects the contract family: BTC_USDT and BTC_USDC are USDT- and USDC-margined contracts, BTC_USD is coin-margined; the quote currency must be USDT, USDC or USD. KuCoin futures write BTC as XBT; both BTC_USDT and XBT_USDT are accepted, and returned symbols always use BTC.

Contract codeDescription
swapPerpetual contract.
quarterThe nearest-expiry delivery contract of the trading pair (coin-margined).
next_quarterThe second-nearest-expiry delivery contract of the trading pair (coin-margined).

quarter and next_quarter are picked by expiry from the exchange's contract list.

Native contract code examples: XBTMZ26

Delivery contracts further out use the KuCoin native contract code (upper case with digits), for example trading pair BTC_USD with contract code XBTMZ26; in exchange.GetMarkets the third and later expiring delivery contracts also use the native code as their contract code.

Exchange-specific IO Commands
KuCoin (Spot)

No exchange-specific commands; for the common commands see exchange.IO.

Futures_KuCoin (Futures)
CommandArgumentsDescriptionReturns
crossbool[, symbol]Cross (true) / isolated (false) margin. Switches the margin mode of the current (or given) contract on the exchange and uses it as the margin mode of all subsequent orders.Null also on success; check GetLastError() afterwards when needed.

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

Function Support
KuCoin (Spot)

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

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w; other periods are synthesized by the docker.
Futures_KuCoin (Futures)

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

Served through a fallback:

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

Margin, Account and Simulation
Futures_KuCoin (Futures)

Margin mode: Switch cross/isolated margin with exchange.IO("cross", bool) (cross by default). The exchange keeps the margin mode per contract, but the exchange object remembers only the last mode switched to and sends it with every order; KuCoin requires an order's margin mode to match the contract's current setting, so after switching contract A, an order on contract B whose mode differs is rejected by the exchange.

Position mode: Orders are placed for one-way position mode (no position-side parameter); closing orders are sent as reduce-only.

Account: KuCoin futures have no set-leverage endpoint: exchange.SetMarginLevel() only records the leverage per contract locally and sends it with each order (10x when not set). In cross mode the exchange uses the contract's leverage setting on the exchange, not the leverage in the order. exchange.GetAccount() and exchange.GetAssets() query accounts by settlement currency: USDT and USDC contracts use the account of that quote currency, coin-margined contracts the account of the base coin (such as BTC); without a symbol every settlement currency's account is queried.

Notes
KuCoin (Spot)
  • The amount of a market buy order is the quote-currency amount to spend (KuCoin's funds); a market sell order is in base currency. Conditional buy orders that execute at market after triggering work the same way.
  • Limit orders support tif ioc, fok and post-only (postOnly).
  • exchange.ModifyOrder() makes KuCoin issue a new order ID: the new order ID is returned and the original ID becomes invalid.
  • exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() need a pair (the current pair when omitted); an empty string fails.
  • Conditional orders support take-profit and stop-loss only, not OCO (KuCoin has no OCO endpoint); modifying a conditional order is not supported, cancel and recreate it instead. Conditional orders live in a separate order space from regular orders; cancel and query them with the conditional-order functions.
Futures_KuCoin (Futures)
  • Order amounts are numbers of contracts and must be positive whole numbers; what one contract represents is the CtVal in exchange.GetMarkets(): some base currency for USDT and USDC contracts, 1 USD per contract for coin-margined contracts.
  • exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() need a specific contract (the current contract when omitted); an empty string or a range fails.
  • Limit orders support tif IOC and maker-only (postOnly), but not FOK; market orders do not support these options and report an error when they are passed.
  • Conditional orders support take-profit and stop-loss only, not OCO (KuCoin futures have no OCO endpoint); they trigger on the last traded price.