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

Crypto (Spot): Crypto.com Exchange spot trading (Exchange v1 API https://api.crypto.com/exchange/v1), accessed with an API Key and Secret Key, including spot margin orders (exchange.IO("trade_margin")). Balances come from the Crypto.com unified account; Crypto.com derivatives are a separate exchange object, Futures_Crypto.

Futures_Crypto (Futures): Crypto.com Exchange derivatives: perpetual and delivery contracts (Exchange v1 API https://api.crypto.com/exchange/v1), accessed with an API Key and Secret Key. Tokens in the account can be converted into a USD-denominated amount used as futures margin; position queries and the leverage setting apply to the master account, and exchange.IO("accountId", ...) selects another account. Crypto.com spot is a separate exchange object, Crypto.

Names and Configuration
exchange.GetName()TypeAliases
CryptoSpot—
Futures_CryptoFuturesCrypto.com Futures
FieldRequired
--
Access KeyYes
Secret KeyYes

Trading Pairs and Contract Codes
Crypto (Spot)

Pair examples: BTC_USDT, CRO_USD

Trading pairs are written BASE_QUOTE, the same as Crypto.com's instrument names.

Futures_Crypto (Futures)

Pair examples: BTC_USD, ETH_USD

Trading pairs look like BTC_USD, matching Crypto.com's BTCUSD-PERP (perpetual) and BTCUSD-YYMMDD (delivery).

Contract codeDescription
swapPerpetual contract.
JanuaryThe delivery contract expiring in January.
FebruaryThe delivery contract expiring in February.
MarchThe delivery contract expiring in March.
AprilThe delivery contract expiring in April.
MayThe delivery contract expiring in May.
JuneThe delivery contract expiring in June.
JulyThe delivery contract expiring in July.
AugustThe delivery contract expiring in August.
SeptemberThe delivery contract expiring in September.
OctoberThe delivery contract expiring in October.
NovemberThe delivery contract expiring in November.
DecemberThe delivery contract expiring in December.
this_weekThe nearest-expiring delivery contract.
next_weekThe second-nearest-expiring delivery contract.
quarterThe nearest delivery contract expiring in March, June, September or December.
next_quarterThe second-nearest delivery contract expiring in March, June, September or December.

Delivery contracts use the English name of the expiry month as the contract code, for example trading pair BTC_USD with contract code October, meaning the latest-expiring delivery contract (the monthly contract) in the nearest such month. Other delivery contracts in the same month (weekly contracts, for example) use the native contract code as the contract code, such as BTC_USD.BTCUSD-261009. Delivery contracts in exchange.GetMarkets follow the same naming and each contract appears once.

Native contract code examples: BTCUSD-261030

Crypto.com delivery contract codes in the form BTCUSD-YYMMDD can also be used directly.

Exchange-specific IO Commands
Crypto (Spot)
CommandArgumentsDescriptionReturns
apihttpMethod, method[, params[, raw]]Call a Crypto.com endpoint directly; the resource is the RPC method name, such as private/user-balance or public/get-tickers (a path starting with /exchange/v1/ or a full URL also works). (more below the table)The complete exchange response (code is 0); null on a business error.
trade_margin—Switch to spot margin; subsequent regular orders are placed with spot_margin=MARGIN, and conditional orders with MARGIN_ORDER in exec_inst. Affects order placement only; no request is sent to the exchange.The command name itself.
trade_normal—Switch back to regular spot orders (the default).The command name itself.

The rest of the longer descriptions in the table:

  • api: Requests are signed by default and sent as a JSON-RPC body, with the params object keeping its JSON types (nested objects and arrays are sent as they are); a raw JSON object string replaces params entirely. With the sign argument set to false the request is unsigned, and GET parameters go into the query string.

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

Futures_Crypto (Futures)
CommandArgumentsDescriptionReturns
apihttpMethod, method[, params[, raw]]Call a Crypto.com endpoint directly; the resource is the RPC method name, such as private/get-positions or public/get-tickers (a path starting with /exchange/v1/ or a full URL also works). (more below the table)The complete exchange response (code is 0); null on a business error.
accountIdstringSet the trading account ID (account uuid) used for querying positions and setting leverage; the master account is used when not set.An object such as {"accountId": "..."}.

The rest of the longer descriptions in the table:

  • api: Requests are signed by default and sent as a JSON-RPC body, with the params object keeping its JSON types (nested objects and arrays are sent as they are); a raw JSON object string replaces params entirely. With the sign argument set to false the request is unsigned, and GET parameters go into the query string.

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

Common Usage
Call the API by JSON-RPC method name
javascript
function main() { // Private method: signed by default, sent as a JSON-RPC request body; // the whole reply (code 0) is returned var r = exchange.IO("api", "POST", "private/user-balance") Log(r.result.data[0].position_balances) // Public method: false as the last argument skips signing; GET params go in the query var t = exchange.IO("api", "GET", "public/get-tickers", "instrument_name=BTC_USDT", false) Log(t.result.data[0]) // {"i": "BTC_USDT", "a": "...", "b": "...", "k": "...", ...} }
Look up the account uuids and choose the account for positions and leverage (Futures_Crypto only)
javascript
function main() { var r = exchange.IO("api", "POST", "private/get-accounts") var uuid = r.result.master_account.uuid Log("Master account:", uuid, "Sub-accounts:", r.result.sub_account_list) // Positions and leverage now use this account (the master account when not set) Log(exchange.IO("accountId", uuid)) // {"accountId": "..."} Log(exchange.GetPositions()) }

Function Support

No unsupported standard functions.

Served through a fallback:

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

Margin, Account and Simulation
Futures_Crypto (Futures)

Margin mode: Cross margin on the unified account with no isolated mode; the margin mode in exchange.GetPositions() is always cross; exchange.IO("cross", ...) fails.

Position mode: One-way positions: each contract has a single net position, with Crypto.com expressing long and short by the sign of the quantity; exchange.IO("dual", ...) fails.

Account: exchange.SetMarginLevel() sets the leverage of the whole trading account (Crypto.com's account-level leverage); it must be an integer from 1 to 100.

Notes
Crypto (Spot)
  • The amount of a market buy order is in the base currency (Crypto.com's quantity), not a quote-currency amount; a conditional buy order that becomes a market order when triggered is also placed in the base currency.
  • Conditional orders support take-profit and stop-loss only, not OCO; they trigger on the last traded price. Conditional orders are placed, modified, canceled and queried through Crypto.com's Advanced Order Management API.
  • Limit orders support tif IOC, FOK and maker-only (postOnly); maker-only cannot be combined with IOC or FOK, and passing tif or postOnly on a market order reports an error. Conditional orders with an order price (a limit order once triggered) support tif and postOnly too; conditional orders that execute at market once triggered report an error when given them.
  • exchange.ModifyOrder() and exchange.ModifyConditionOrder() are supported (Crypto.com amends the order in place, keeping its order ID); conditional orders can change the trigger price, order price and amount, and an order price of -1 turns a conditional limit order into one that executes at market when triggered (a positive price does the reverse). tif and postOnly cannot be changed (passing them reports an error).
  • exchange.GetOrders() and exchange.GetConditionOrders() without arguments return the open orders of all trading pairs. exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() return the latest 100 records when limit is not given, and page automatically to fill a larger limit. Without since, Crypto.com returns only the last day of conditional order history; pass since to query earlier records.
  • The frozen amount in exchange.GetAssets() is Crypto.com's reserved_qty (open orders plus margin in use), and the available amount is the holding minus it.
Futures_Crypto (Futures)
  • exchange.GetFundings cannot query in batch: without arguments or with a range (such as USD.swap) it reports an error and returns a null value; pass a specific perpetual symbol such as BTC_USD.swap.
  • Funding settles every hour; the rate is Crypto.com's funding_rate valuation.
  • The order amount is sent as Crypto.com's quantity directly; see CtVal in exchange.GetMarkets for the contract size (CtValCcy, the size currency, is the underlying coin).
  • Conditional orders support take-profit and stop-loss only, not OCO; they trigger on the mark price.
  • Limit orders support tif IOC, FOK and maker-only (postOnly); maker-only cannot be combined with IOC or FOK, and passing tif or postOnly on a market order reports an error. Conditional orders with an order price (a limit order once triggered) support tif and postOnly too; conditional orders that execute at market once triggered report an error when given them. Both regular and conditional orders support reduce-only (reduceOnly).
  • exchange.ModifyOrder() and exchange.ModifyConditionOrder() are supported (Crypto.com amends the order in place); conditional orders can change the trigger price, order price and amount, and an order price of -1 turns a conditional limit order into one that executes at market when triggered (a positive price does the reverse). tif and postOnly cannot be changed (passing them reports an error).
  • Without since, exchange.GetHistoryConditionOrders() returns only the last day of conditional order history from Crypto.com; pass since to query earlier records.