Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
exchange.IO
exchange.IO("api", ...)
exchange.IO("currency", ...)
exchange.IO("base", ...)
exchange.IO(mode, value)
exchange.IO("rate", ...)
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Calls other interfaces related to the exchange object.

exchange.IO(k, ...args)

Examples

Switch the margin mode and call a raw exchange endpoint (Binance futures as an example).

javascript
function main() { exchange.SetContractType("swap") // Switch the current contract to isolated margin exchange.IO("cross", false) // The third argument names the contract: switch the ETH_USDT perpetual to cross margin exchange.IO("cross", true, "ETH_USDT.swap") // Call an endpoint that has no wrapper function var ret = exchange.IO("api", "GET", "/fapi/v1/time") Log(ret) }
python
def main(): exchange.SetContractType("swap") exchange.IO("cross", False) exchange.IO("cross", True, "ETH_USDT.swap") ret = exchange.IO("api", "GET", "/fapi/v1/time") Log(ret)
rust
fn main() { let _ = exchange.SetContractType("swap"); // Switch the current contract to isolated margin let _ = exchange.IO(("cross", false)); // The third argument names the contract: switch the ETH_USDT perpetual to cross margin let _ = exchange.IO(("cross", true, "ETH_USDT.swap")); // Call an endpoint that has no wrapper function let ret = exchange.IO(("api", "GET", "/fapi/v1/time")); Log!(ret); }

Returns

TypeDescription

string / number / bool / object / array / any

The return value depends on the command, and some commands return a null value on success; a failed call returns a null value, and the error message can be obtained with GetLastError.

Arguments

NameTypeRequiredDescription

k

string

Yes

Call type identifier. Different values correspond to different functions; please refer to the descriptions in each section below for details.

args

string / number / bool / object / array / any

No

Extended parameters. Different parameters are passed according to the k value; their number and types are not fixed, and some commands take no parameters.

See Also

Remarks

Commands at a glance
CommandDescription
apiCall a raw exchange endpoint that has no wrapper function
currencySwitch the trading pair at runtime
baseQuery or switch the API base address
simulate, cross, dual, unified and moreSwitch trading modes, see exchange.IO(mode, value)
rate / quotaRate-limit API calls

Each command has its own page in this category; commands specific to an exchange object are indexed below and documented on the exchange pages (see Capability Matrix).

Return values and error checking

The return value depends on the command. Some commands (for example cross, dual or unified on some futures exchanges) return a null value on success, which is the same as the value returned on failure; to confirm success, read the error message with GetLastError after the call. A command the exchange does not support reports an error (unsupported io method) and returns a null value.

Commands that act on a specific contract, such as cross, dual and unified, accept a symbol argument after the value to name the contract, for example exchange.IO("cross", false, "ETH_USDT.swap"); without it they act on the current trading pair and contract. Whether such a command applies per contract or to the whole account, and what each command returns, is given in the IO command table of the exchange page.

Exchange-specific commands

Commands of exchange.IO() specific to an exchange object; see the exchange page for arguments and details.

CommandExchanges
abiPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
accountIdFutures_Crypto, Poloniex
accountsFutures_Futu, Futures_IB
accountTypeBybit, Futures_Bybit
addressPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter, OKX_DEX, Web3
addressesOKX_DEX
agentFutures_Boros
allChainBalanceOKX_DEX
allowanceOKX_DEX
allTokensOKX_DEX
apiBackpack, Futures_Backpack, BigONE, Bitstamp, Coinw, Crypto, Futures_Crypto, DigiFinex, Futures_DigiFinex, WOO, Futures_WOO, Hyperliquid, Futures_Hyperliquid, Futures_Lighter, Futures_EdgeX, Futures_Aevo, Pendle, Futures_Boros, Futures_WOOFi, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Futures_Polymarket, Futures_IB, Exchange, Web3
approvePendle, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX
approveAgentFutures_Boros
apyPendle
autoTopUpFutures_Boros
balanceSupportedChainsOKX_DEX
baseFutures_Binance, Pendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter, Futures_Polymarket, Web3
batchOrdersFutures_Polymarket
bridge.apiKeyUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.chainsUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.quoteUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.sendUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.simulateUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.statusUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
bridge.tokensUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
broadcastOKX_DEX
broadcastSupportedChainsOKX_DEX
calcOrderHashAndSignFutures_EdgeX
callPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
cancelTxPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
cancelWaitPendle, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch
cancelWithdrawFutures_Boros
chainOKX_DEX
clientIdKyberSwap
clobFutures_Polymarket
coinmBaseFutures_Binance
configOKX_DEX
contractsUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Web3
crossFutures_Binance, Futures_Bitget, Futures_Bybit, Futures_Coinw, Futures_DeepCoin, Futures_DigiFinex, Futures_GateIO, Futures_HuobiDM, Futures_Kraken, Futures_KuCoin, Futures_MEXC, Futures_OKCoin, Futures_WOO, Futures_Hyperliquid, Futures_Lighter, Futures_ApolloX, Futures_Aster
dataFutures_Polymarket
dca.cancelJupiter
dca.createJupiter
dca.listJupiter
dca.simulateJupiter
deadlineUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch
debugFutures_IB
decodePendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
depositFutures_Boros
dexFutures_Hyperliquid
dexesJupiter
dualFutures_Binance, Futures_Bitget, Futures_Bybit, Futures_GateIO, Futures_HuobiDM, Futures_OKCoin, Futures_WOO, Futures_ApolloX, Futures_Aster
eapiBaseFutures_Binance
encodePendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
encodePackedPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
expiresAfterHyperliquid, Futures_Hyperliquid
expiryFutures_Lighter
fromUnitsPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
gammaFutures_Polymarket
gasBalanceFutures_Boros
gasLevelOKX_DEX
gasMultiplierPendle, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX
hashWeb3
historyKlinesFutures_Futu
ignoreFutures_IB
instrumentFutures_Futu
ioExchange
isolatedTransferFutures_Boros
keyOKX_DEX, Web3
kyberApiKeyKyberSwap
lockFutures_Futu
logsPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
lp.addUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.claimAerodrome, Velodrome
lp.collectUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.decreaseUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.historyUniswap, PancakeSwap, Aerodrome, Velodrome
lp.increaseUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.planUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.poolUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.poolsUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.positionsUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.removeUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.selectUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.simulateUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.stakeAerodrome, Velodrome
lp.ticksUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.trackUniswap, PancakeSwap, Aerodrome, Velodrome, Jupiter
lp.unstakeAerodrome, Velodrome
marketPendle, Futures_Boros
marketDataTypeFutures_IB
markets_cursorFutures_Polymarket
marketSupportedChainsOKX_DEX
mbaseFutures_Bitfinex
mergeFutures_DeepCoin, Futures_Hyperliquid, Futures_Polymarket
mergeQuestionFutures_Hyperliquid
multicallPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
negateFutures_Hyperliquid
noncePendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
orderExpiryPendle
orderIdFutures_IB
pricePendle
priorityFeeJupiter
proxyWalletAddressFutures_Polymarket
pump.buyJupiter
pump.holdingsJupiter
pump.infoJupiter
pump.newJupiter
pump.quoteJupiter
pump.sellJupiter
quoteOKX_DEX
receiptPendle, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
redeemFutures_Polymarket
refreshFutures_Futu
regChainOKX_DEX
regTokenOKX_DEX
reqIdFutures_IB
routeUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
rpcFutures_Boros, OKX_DEX
rpsJupiter
scanFutures_IB
selfTradePreventionModeBackpack, Futures_Backpack, Binance, Futures_Binance
sendBaseUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Web3
signPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
signHostFutures_HuobiDM
signingKeyFutures_Aevo
signMessagePendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
signTxOKX_DEX
signTypedDataPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
simulateBitget, Futures_Bitget, Futures_DigiFinex, OKEX, Futures_OKCoin, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch
slippagePendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter, OKX_DEX
sourceHyperliquid, Futures_Hyperliquid
speedUpPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
splitFutures_Hyperliquid, Futures_Polymarket
statusFutures_Futu, Futures_IB
statusDetailFutures_Futu
subAccountGemini
swapSupportedChainsOKX_DEX
tdModeOKEX, Futures_OKCoin
tickFutures_Boros
tickers_cursorFutures_Polymarket
timeFutures_IB
timeoutFutures_Futu
tokenUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
tokenSearchOKX_DEX
topUpGasFutures_Boros
toUnitsPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
trade_marginBinance, Bybit, Crypto, GateIO, Huobi, OKEX, WOO
trade_normalBinance, Bybit, Crypto, GateIO, Huobi, OKEX, WOO
trade_super_marginBinance, GateIO, Huobi, OKEX
transferUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, Jupiter
trigger.apiJupiter
trigger.simulateJupiter
trigger.vaultJupiter
unifiedBinance, Futures_Binance, GateIO, Futures_GateIO, Futures_HuobiDM
uniswapV3Pendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
unlockFutures_Futu
unwrapUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch
vaultAddressHyperliquid, Futures_Hyperliquid
versionBitfinex
waitFutures_Futu, Futures_IB
waitReceiptPendle, Futures_Boros, Uniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch, OKX_DEX, Web3
walletFutures_Boros
walletAddressHyperliquid, Futures_Hyperliquid
withdrawFutures_Boros
wrapUniswap, PancakeSwap, Aerodrome, Velodrome, KyberSwap, OneInch