xt
xt cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.
xt
Kind: global class
Extends: Exchange
- fetchTime
- fetchCurrencies
- fetchMarkets
- fetchOHLCV
- fetchOrderBook
- fetchTicker
- fetchTickers
- fetchBidsAsks
- fetchTrades
- fetchMyTrades
- fetchBalance
- createMarketBuyOrderWithCost
- createOrder
- fetchOrder
- fetchOrders
- fetchOpenOrders
- fetchClosedOrders
- fetchCanceledOrders
- cancelOrder
- cancelAllOrders
- cancelOrders
- fetchLedger
- fetchDepositAddress
- fetchDeposits
- fetchWithdrawals
- withdraw
- setLeverage
- addMargin
- reduceMargin
- fetchLeverageTiers
- fetchMarketLeverageTiers
- fetchFundingRateHistory
- fetchFundingInterval
- fetchFundingRate
- fetchFundingHistory
- fetchPosition
- fetchPositions
- transfer
- setMarginMode
- editOrder
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
| Param | Type | Description |
|---|---|---|
| params | object | extra 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
| Param | Type | Description |
|---|---|---|
| params | object | extra 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
| Param | Type | Description |
|---|---|---|
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | string | Yes | the length of time each candle represents |
| since | int | No | timestamp in ms of the earliest candle to fetch |
| limit | int | No | the maximum amount of candles to fetch |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.until | int | No | timestamp in ms of the latest candle to fetch |
| params.paginate | boolean | No | default 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol to fetch the order book for |
| limit | int | No | the maximum amount of order book entries to return |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol to fetch the ticker for |
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | string | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | string | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol to fetch trades for |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum amount of trades to fetch |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol to fetch trades for |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum amount of trades to fetch |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to create an order in |
| cost | float | Yes | how much you want to trade in units of the quote currency |
| params | object | No | extra 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
- https://doc.xt.com/#orderorderPost
- https://doc.xt.com/#futures_ordercreate
- https://doc.xt.com/#futures_entrustcreatePlan
- https://doc.xt.com/#futures_entrustcreateProfit
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to create an order in |
| type | string | Yes | 'market' or 'limit' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | how much you want to trade in units of the base currency |
| price | float | No | the price to fulfill the order, in units of the quote currency, can be ignored in market orders |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'GTX' |
| params.entrustType | string | No | '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.triggerPriceType | string | No | 'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined |
| params.triggerPrice | float | No | price to trigger a stop order |
| params.stopPrice | float | No | alias for triggerPrice |
| params.stopLoss | float | No | price to set a stop-loss on an open position |
| params.takeProfit | float | No | price 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
- https://doc.xt.com/#orderorderGet
- https://doc.xt.com/#futures_ordergetById
- https://doc.xt.com/#futures_entrustgetPlanById
- https://doc.xt.com/#futures_entrustgetProfitById
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | No | unified symbol of the market the order was made in |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
- https://doc.xt.com/#orderhistoryOrderGet
- https://doc.xt.com/#futures_ordergetHistory
- https://doc.xt.com/#futures_entrustgetPlanHistory
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market the orders were made in |
| since | int | No | timestamp in ms of the earliest order |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if 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
- https://doc.xt.com/#orderopenOrderGet
- https://doc.xt.com/#futures_ordergetOrders
- https://doc.xt.com/#futures_entrustgetPlan
- https://doc.xt.com/#futures_entrustgetProfit
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market the orders were made in |
| since | int | No | timestamp in ms of the earliest order |
| limit | int | No | the maximum number of open order structures to retrieve |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
- https://doc.xt.com/#orderhistoryOrderGet
- https://doc.xt.com/#futures_ordergetOrders
- https://doc.xt.com/#futures_entrustgetPlan
- https://doc.xt.com/#futures_entrustgetProfit
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market the orders were made in |
| since | int | No | timestamp in ms of the earliest order |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
- https://doc.xt.com/#orderhistoryOrderGet
- https://doc.xt.com/#futures_ordergetOrders
- https://doc.xt.com/#futures_entrustgetPlan
- https://doc.xt.com/#futures_entrustgetProfit
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market the orders were made in |
| since | int | No | timestamp in ms of the earliest order |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
- https://doc.xt.com/#orderorderDel
- https://doc.xt.com/#futures_ordercancel
- https://doc.xt.com/#futures_entrustcancelPlan
- https://doc.xt.com/#futures_entrustcancelProfit
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | No | unified symbol of the market the order was made in |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
- https://doc.xt.com/#orderopenOrderDel
- https://doc.xt.com/#futures_ordercancelBatch
- https://doc.xt.com/#futures_entrustcancelPlanBatch
- https://doc.xt.com/#futures_entrustcancelProfitBatch
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market to cancel orders in |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.trigger | bool | No | if the order is a trigger order or not |
| params.stopLossTakeProfit | bool | No | if 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
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> | Yes | order ids |
| symbol | string | No | unified market symbol of the market to cancel orders in |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | unified currency code |
| since | int | No | timestamp in ms of the earliest ledger entry |
| limit | int | No | max number of ledger entries to return |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| code | string | unified currency code |
| params | object | extra parameters specific to the xt api endpoint |
| params.network | string | required 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | unified currency code |
| since | int | No | the earliest time in ms to fetch deposits for |
| limit | int | No | the maximum number of transaction structures to retrieve |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | unified currency code |
| since | int | No | the earliest time in ms to fetch withdrawals for |
| limit | int | No | the maximum number of transaction structures to retrieve |
| params | object | Yes | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| amount | float | Yes | the amount to withdraw |
| address | string | Yes | the address to withdraw to |
| tag | string | No | |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| leverage | float | the rate of leverage |
| symbol | string | unified market symbol |
| params | object | extra parameters specific to the xt api endpoint |
| params.positionSide | string | '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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol |
| amount | float | amount of margin to add |
| params | object | extra parameters specific to the xt api endpoint |
| params.positionSide | string | '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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol |
| amount | float | the amount of margin to remove |
| params | object | extra parameters specific to the xt api endpoint |
| params.positionSide | string | '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
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | string | No | a list of unified market symbols |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol |
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified symbol of the market to fetch the funding rate history for |
| since | int | No | timestamp in ms of the earliest funding rate to fetch |
| limit | int | No | the maximum amount of [funding rate structures] to fetch |
| params | object | Yes | extra parameters specific to the xt api endpoint |
| params.paginate | bool | Yes | true/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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra 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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol |
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| since | int | No | the starting timestamp in milliseconds |
| limit | int | No | the number of entries to return |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| symbol | string | unified market symbol of the market the position is held in |
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | string | No | list of unified market symbols, not supported with xt |
| params | object | Yes | extra 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
| Param | Type | Description |
|---|---|---|
| code | string | unified currency code |
| amount | float | amount to transfer |
| fromAccount | string | account to transfer from - spot, swap, leverage, finance |
| toAccount | string | account to transfer to - spot, swap, leverage, finance |
| params | object | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| marginMode | string | Yes | 'cross' or 'isolated' |
| symbol | string | No | required |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.positionSide | string | No | required "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
- https://doc.xt.com/#orderorderUpdate
- https://doc.xt.com/#futures_orderupdate
- https://doc.xt.com/#futures_entrustupdateProfit
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | Yes | unified symbol of the market to create an order in |
| type | string | Yes | 'market' or 'limit' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | how much of the currency you want to trade in units of the base currency |
| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.stopLoss | float | No | price to set a stop-loss on an open position |
| params.takeProfit | float | No | price to set a take-profit on an open position |
xt.editOrder (id, symbol, type, side, amount, price?, params?)