CCXT

xt

xt cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.

xt

Kind: global class
Extends: Exchange

fetchTime

fetches the current integer timestamp in milliseconds from the xt server

Kind: instance method of xt
Returns: int - the current integer timestamp in milliseconds from the xt server

See: https://doc.xt.com/#market1serverInfo

ParamTypeDescription
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchTime (params)

fetchCurrencies

fetches all available currencies on an exchange

Kind: instance method of xt
Returns: object - an associative dictionary of currencies

See: https://doc.xt.com/#deposit_withdrawalsupportedCurrenciesGet

ParamTypeDescription
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchCurrencies (params)

fetchMarkets

retrieves data on all markets for xt

Kind: instance method of xt
Returns: Array<object> - an array of objects representing market data

See

ParamTypeDescription
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchMarkets (params)

fetchOHLCV

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of xt
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectYesextra parameters specific to the xt api endpoint
params.untilintNotimestamp in ms of the latest candle to fetch
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
xt.fetchOHLCV (symbol, timeframe, since?, limit?, params)

fetchOrderBook

fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of xt
Returns: object - A dictionary of order book structures indexed by market symbols

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchOrderBook (symbol, limit?, params)

fetchTicker

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of xt
Returns: object - a ticker structure

See

ParamTypeDescription
symbolstringunified market symbol to fetch the ticker for
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchTicker (symbol, params)

fetchTickers

fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market

Kind: instance method of xt
Returns: object - an array of ticker structures

See

ParamTypeRequiredDescription
symbolsstringNounified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchTickers (symbols?, params)

fetchBidsAsks

fetches the bid and ask price and volume for multiple markets

Kind: instance method of xt
Returns: object - a dictionary of ticker structures

See: https://doc.xt.com/#market9tickerBook

ParamTypeRequiredDescription
symbolsstringNounified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchBidsAsks (symbols?, params)

fetchTrades

get the list of most recent trades for a particular symbol

Kind: instance method of xt
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchTrades (symbol, since?, limit?, params)

fetchMyTrades

fetch all trades made by the user

Kind: instance method of xt
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchMyTrades (symbol?, since?, limit?, params)

fetchBalance

query for balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of xt
Returns: object - a balance structure

See

ParamTypeDescription
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchBalance (params)

createMarketBuyOrderWithCost

create a market buy order by providing the symbol and cost

Kind: instance method of xt
Returns: object - an order structure

See: https://doc.xt.com/#orderorderPost

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
costfloatYeshow much you want to trade in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
xt.createMarketBuyOrderWithCost (symbol, cost, params?)

createOrder

create a trade order

Kind: instance method of xt
Returns: object - an order structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much you want to trade in units of the base currency
pricefloatNothe price to fulfill the order, in units of the quote currency, can be ignored in market orders
paramsobjectYesextra parameters specific to the xt api endpoint
params.timeInForcestringNo'GTC', 'IOC', 'FOK' or 'GTX'
params.entrustTypestringNo'TAKE_PROFIT', 'STOP', 'TAKE_PROFIT_MARKET', 'STOP_MARKET', 'TRAILING_STOP_MARKET', required if stopPrice is defined, currently isn't functioning on xt's side
params.triggerPriceTypestringNo'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined
params.triggerPricefloatNoprice to trigger a stop order
params.stopPricefloatNoalias for triggerPrice
params.stopLossfloatNoprice to set a stop-loss on an open position
params.takeProfitfloatNoprice to set a take-profit on an open position
xt.createOrder (symbol, type, side, amount, price?, params)

fetchOrder

fetches information on an order made by the user

Kind: instance method of xt
Returns: object - An order structure

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringNounified symbol of the market the order was made in
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.fetchOrder (id, symbol?, params)

fetchOrders

fetches information on multiple orders made by the user

Kind: instance method of xt
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market the orders were made in
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of order structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
xt.fetchOrders (symbol?, since?, limit?, params)

fetchOpenOrders

fetch all unfilled currently open orders

Kind: instance method of xt
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market the orders were made in
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of open order structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.fetchOpenOrders (symbol?, since?, limit?, params)

fetchClosedOrders

fetches information on multiple closed orders made by the user

Kind: instance method of xt
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market the orders were made in
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of order structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.fetchClosedOrders (symbol?, since?, limit?, params)

fetchCanceledOrders

fetches information on multiple canceled orders made by the user

Kind: instance method of xt
Returns: object - a list of order structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market the orders were made in
sinceintNotimestamp in ms of the earliest order
limitintNothe maximum number of order structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.fetchCanceledOrders (symbol?, since?, limit?, params)

cancelOrder

cancels an open order

Kind: instance method of xt
Returns: object - An order structure

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringNounified symbol of the market the order was made in
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.cancelOrder (id, symbol?, params)

cancelAllOrders

cancel all open orders in a market

Kind: instance method of xt
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market to cancel orders in
paramsobjectYesextra parameters specific to the xt api endpoint
params.triggerboolNoif the order is a trigger order or not
params.stopLossTakeProfitboolNoif the order is a stop-loss or take-profit order
xt.cancelAllOrders (symbol?, params)

cancelOrders

cancel multiple orders

Kind: instance method of xt
Returns: Array<object> - a list of order structures

See: https://doc.xt.com/#orderbatchOrderDel

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringNounified market symbol of the market to cancel orders in
paramsobjectYesextra parameters specific to the xt api endpoint
xt.cancelOrders (ids, symbol?, params)

fetchLedger

fetch the history of changes, actions done by the user or operations that altered the balance of the user

Kind: instance method of xt
Returns: object - a ledger structure

See: https://doc.xt.com/#futures_usergetBalanceBill

ParamTypeRequiredDescription
codestringNounified currency code
sinceintNotimestamp in ms of the earliest ledger entry
limitintNomax number of ledger entries to return
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchLedger (code?, since?, limit?, params)

fetchDepositAddress

fetch the deposit address for a currency associated with this account

Kind: instance method of xt
Returns: object - an address structure

See: https://doc.xt.com/#deposit_withdrawaldepositAddressGet

ParamTypeDescription
codestringunified currency code
paramsobjectextra parameters specific to the xt api endpoint
params.networkstringrequired network id
xt.fetchDepositAddress (code, params)

fetchDeposits

fetch all deposits made to an account

Kind: instance method of xt
Returns: Array<object> - a list of transaction structures

See: https://doc.xt.com/#deposit_withdrawalhistoryDepositGet

ParamTypeRequiredDescription
codestringNounified currency code
sinceintNothe earliest time in ms to fetch deposits for
limitintNothe maximum number of transaction structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchDeposits (code?, since?, limit?, params)

fetchWithdrawals

fetch all withdrawals made from an account

Kind: instance method of xt
Returns: Array<object> - a list of transaction structures

See: https://doc.xt.com/#deposit_withdrawalwithdrawHistory

ParamTypeRequiredDescription
codestringNounified currency code
sinceintNothe earliest time in ms to fetch withdrawals for
limitintNothe maximum number of transaction structures to retrieve
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchWithdrawals (code?, since?, limit?, params)

withdraw

make a withdrawal

Kind: instance method of xt
Returns: object - a transaction structure

See: https://doc.xt.com/#deposit_withdrawalwithdraw

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesthe amount to withdraw
addressstringYesthe address to withdraw to
tagstringNo
paramsobjectYesextra parameters specific to the xt api endpoint
xt.withdraw (code, amount, address, tag?, params)

setLeverage

set the level of leverage for a market

Kind: instance method of xt
Returns: object - response from the exchange

See: https://doc.xt.com/#futures_useradjustLeverage

ParamTypeDescription
leveragefloatthe rate of leverage
symbolstringunified market symbol
paramsobjectextra parameters specific to the xt api endpoint
params.positionSidestring'LONG' or 'SHORT'
xt.setLeverage (leverage, symbol, params)

addMargin

add margin to a position

Kind: instance method of xt
Returns: object - a margin structure

See: https://doc.xt.com/#futures_useradjustMargin

ParamTypeDescription
symbolstringunified market symbol
amountfloatamount of margin to add
paramsobjectextra parameters specific to the xt api endpoint
params.positionSidestring'LONG' or 'SHORT'
xt.addMargin (symbol, amount, params)

reduceMargin

remove margin from a position

Kind: instance method of xt
Returns: object - a margin structure

See: https://doc.xt.com/#futures_useradjustMargin

ParamTypeDescription
symbolstringunified market symbol
amountfloatthe amount of margin to remove
paramsobjectextra parameters specific to the xt api endpoint
params.positionSidestring'LONG' or 'SHORT'
xt.reduceMargin (symbol, amount, params)

fetchLeverageTiers

retrieve information on the maximum leverage for different trade sizes

Kind: instance method of xt
Returns: object - a dictionary of leverage tiers structures

See: https://doc.xt.com/#futures_quotesgetLeverageBrackets

ParamTypeRequiredDescription
symbolsstringNoa list of unified market symbols
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchLeverageTiers (symbols?, params)

fetchMarketLeverageTiers

retrieve information on the maximum leverage for different trade sizes of a single market

Kind: instance method of xt
Returns: object - a leverage tiers structure

See: https://doc.xt.com/#futures_quotesgetLeverageBracket

ParamTypeDescription
symbolstringunified market symbol
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchMarketLeverageTiers (symbol, params)

fetchFundingRateHistory

fetches historical funding rates

Kind: instance method of xt
Returns: Array<object> - a list of funding rate structures

See: https://doc.xt.com/#futures_quotesgetFundingRateRecord

ParamTypeRequiredDescription
symbolstringNounified symbol of the market to fetch the funding rate history for
sinceintNotimestamp in ms of the earliest funding rate to fetch
limitintNothe maximum amount of [funding rate structures] to fetch
paramsobjectYesextra parameters specific to the xt api endpoint
params.paginateboolYestrue/false whether to use the pagination helper to aumatically paginate through the results
xt.fetchFundingRateHistory (symbol?, since?, limit?, params)

fetchFundingInterval

fetch the current funding rate interval

Kind: instance method of xt
Returns: object - a funding rate structure

See: https://doc.xt.com/#futures_quotesgetFundingRate

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
xt.fetchFundingInterval (symbol, params?)

fetchFundingRate

fetch the current funding rate

Kind: instance method of xt
Returns: object - a funding rate structure

See: https://doc.xt.com/#futures_quotesgetFundingRate

ParamTypeDescription
symbolstringunified market symbol
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchFundingRate (symbol, params)

fetchFundingHistory

fetch the funding history

Kind: instance method of xt
Returns: Array<object> - a list of funding history structures

See: https://doc.xt.com/#futures_usergetFunding

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe starting timestamp in milliseconds
limitintNothe number of entries to return
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchFundingHistory (symbol, since?, limit?, params)

fetchPosition

fetch data on a single open contract trade position

Kind: instance method of xt
Returns: object - a position structure

See: https://doc.xt.com/#futures_usergetPosition

ParamTypeDescription
symbolstringunified market symbol of the market the position is held in
paramsobjectextra parameters specific to the xt api endpoint
xt.fetchPosition (symbol, params)

fetchPositions

fetch all open positions

Kind: instance method of xt
Returns: Array<object> - a list of position structure

See: https://doc.xt.com/#futures_usergetPosition

ParamTypeRequiredDescription
symbolsstringNolist of unified market symbols, not supported with xt
paramsobjectYesextra parameters specific to the xt api endpoint
xt.fetchPositions (symbols?, params)

transfer

transfer currency internally between wallets on the same account

Kind: instance method of xt
Returns: object - a transfer structure

See: https://doc.xt.com/#transfersubTransferPost

ParamTypeDescription
codestringunified currency code
amountfloatamount to transfer
fromAccountstringaccount to transfer from - spot, swap, leverage, finance
toAccountstringaccount to transfer to - spot, swap, leverage, finance
paramsobjectextra parameters specific to the whitebit api endpoint
xt.transfer (code, amount, fromAccount, toAccount, params)

setMarginMode

set margin mode to 'cross' or 'isolated'

Kind: instance method of xt
Returns: object - response from the exchange

See: https://doc.xt.com/#futures_userchangePositionType

ParamTypeRequiredDescription
marginModestringYes'cross' or 'isolated'
symbolstringNorequired
paramsobjectNoextra parameters specific to the exchange API endpoint
params.positionSidestringNorequired "long" or "short"
xt.setMarginMode (marginMode, symbol?, params?)

editOrder

cancels an order and places a new order

Kind: instance method of xt
Returns: object - an order structure

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of the currency you want to trade in units of the base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.stopLossfloatNoprice to set a stop-loss on an open position
params.takeProfitfloatNoprice to set a take-profit on an open position
xt.editOrder (id, symbol, type, side, amount, price?, params?)

On this page