## xt{docsify-ignore} **Kind**: global class **Extends**: Exchange * [fetchTime](#fetchtime) * [fetchCurrencies](#fetchcurrencies) * [fetchMarkets](#fetchmarkets) * [fetchOHLCV](#fetchohlcv) * [fetchOrderBook](#fetchorderbook) * [fetchTicker](#fetchticker) * [fetchTickers](#fetchtickers) * [fetchBidsAsks](#fetchbidsasks) * [fetchTrades](#fetchtrades) * [fetchMyTrades](#fetchmytrades) * [fetchBalance](#fetchbalance) * [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) * [createOrder](#createorder) * [fetchOrder](#fetchorder) * [fetchOrders](#fetchorders) * [fetchOpenOrders](#fetchopenorders) * [fetchClosedOrders](#fetchclosedorders) * [fetchCanceledOrders](#fetchcanceledorders) * [cancelOrder](#cancelorder) * [cancelAllOrders](#cancelallorders) * [cancelOrders](#cancelorders) * [fetchLedger](#fetchledger) * [fetchDepositAddress](#fetchdepositaddress) * [fetchDeposits](#fetchdeposits) * [fetchWithdrawals](#fetchwithdrawals) * [withdraw](#withdraw) * [setLeverage](#setleverage) * [addMargin](#addmargin) * [reduceMargin](#reducemargin) * [fetchLeverageTiers](#fetchleveragetiers) * [fetchMarketLeverageTiers](#fetchmarketleveragetiers) * [fetchFundingRateHistory](#fetchfundingratehistory) * [fetchFundingInterval](#fetchfundinginterval) * [fetchFundingRate](#fetchfundingrate) * [fetchOpenInterest](#fetchopeninterest) * [fetchTradingFee](#fetchtradingfee) * [fetchTradingFees](#fetchtradingfees) * [fetchFundingHistory](#fetchfundinghistory) * [fetchPosition](#fetchposition) * [fetchPositions](#fetchpositions) * [fetchPositionsHistory](#fetchpositionshistory) * [transfer](#transfer) * [setMarginMode](#setmarginmode) * [editOrder](#editorder) ### fetchTime{docsify-ignore} fetches the current integer timestamp in milliseconds from the xt server **Kind**: instance method of [xt](#xt) **Returns**: int - the current integer timestamp in milliseconds from the xt server **See**: https://doc.xt.com/docs/spot/Market/GetServerTime | Param | Type | Description | | --- | --- | --- | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchTime (params) ``` ### fetchCurrencies{docsify-ignore} fetches all available currencies on an exchange **Kind**: instance method of [xt](#xt) **Returns**: object - an associative dictionary of currencies **See**: https://doc.xt.com/docs/spot/Deposit&Withdrawal/GetSupportedCurrencies | Param | Type | Description | | --- | --- | --- | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchCurrencies (params) ``` ### fetchMarkets{docsify-ignore} retrieves data on all markets for xt **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - an array of objects representing market data **See** - https://doc.xt.com/docs/spot/Market/GetSymbolInformation - https://doc.xt.com/docs/futures/MarketData/get-configuration-information-for-listed-and-tradeable-symbols | Param | Type | Description | | --- | --- | --- | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchMarkets (params) ``` ### fetchOHLCV{docsify-ignore} fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market **Kind**: instance method of [xt](#xt) **Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume **See** - https://doc.xt.com/docs/spot/Market/GetKlineData - https://doc.xt.com/docs/futures/MarketData/get-trading-pair-information-of-kline | 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 exchange 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](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | ```javascript xt.fetchOHLCV (symbol, timeframe, since?, limit?, params) ``` ### fetchOrderBook{docsify-ignore} fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data **Kind**: instance method of [xt](#xt) **Returns**: object - an [order book structure](https://docs.ccxt.com/en/latest/manual.html#order-book-structure) **See** - https://doc.xt.com/docs/spot/Market/GetDepthData - https://doc.xt.com/docs/futures/MarketData/get-depth-data-of-trading-pairs | 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 exchange API endpoint | ```javascript xt.fetchOrderBook (symbol, limit?, params) ``` ### fetchTicker{docsify-ignore} 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](#xt) **Returns**: object - a [ticker structure](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) **See** - https://doc.xt.com/docs/spot/Market/Get24hStatisticsTicker - https://doc.xt.com/docs/futures/MarketData/get-aggregated-market-information-for-specific-trading-pair | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol to fetch the ticker for | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchTicker (symbol, params) ``` ### fetchTickers{docsify-ignore} fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market **Kind**: instance method of [xt](#xt) **Returns**: object - an array of [ticker structures](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) **See** - https://doc.xt.com/docs/spot/Market/Get24hStatisticsTicker - https://doc.xt.com/docs/futures/MarketData/get_aggregated_market_information_for_all_trading_pairs | 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 exchange API endpoint | ```javascript xt.fetchTickers (symbols?, params) ``` ### fetchBidsAsks{docsify-ignore} fetches the bid and ask price and volume for multiple markets **Kind**: instance method of [xt](#xt) **Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) **See** - https://doc.xt.com/docs/spot/Market/GetBestPendingOrderTicker - https://doc.xt.com/docs/futures/MarketData/get-ask-bid-market-information-for-all-trading-pairs | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | Array<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 exchange API endpoint | ```javascript xt.fetchBidsAsks (symbols?, params) ``` ### fetchTrades{docsify-ignore} get the list of most recent trades for a particular symbol **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/en/latest/manual.html?#public-trades) **See** - https://doc.xt.com/docs/spot/Market/QueryRecentTransactions - https://doc.xt.com/docs/futures/MarketData/get-latest-transaction-information-of-trading-pairs | 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 exchange API endpoint | ```javascript xt.fetchTrades (symbol, since?, limit?, params) ``` ### fetchMyTrades{docsify-ignore} fetch all trades made by the user **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/en/latest/manual.html?#public-trades) **See** - https://doc.xt.com/docs/spot/Trade/QueryTrade - https://doc.xt.com/docs/futures/Order/see-transaction-details | 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 exchange API endpoint | ```javascript xt.fetchMyTrades (symbol?, since?, limit?, params) ``` ### fetchBalance{docsify-ignore} query for balance and get the amount of funds available for trading or funds locked in orders **Kind**: instance method of [xt](#xt) **Returns**: object - a [balance structure](https://docs.ccxt.com/en/latest/manual.html?#balance-structure) **See** - https://doc.xt.com/docs/spot/Balance/GetBalances - https://doc.xt.com/docs/futures/User/GetUserFunds | Param | Type | Description | | --- | --- | --- | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchBalance (params) ``` ### createMarketBuyOrderWithCost{docsify-ignore} create a market buy order by providing the symbol and cost **Kind**: instance method of [xt](#xt) **Returns**: object - an [order structure](https://docs.ccxt.com/?id=order-structure) **See**: https://doc.xt.com/docs/spot/Order/SubmitOrder | 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 | ```javascript xt.createMarketBuyOrderWithCost (symbol, cost, params?) ``` ### createOrder{docsify-ignore} create a trade order **Kind**: instance method of [xt](#xt) **Returns**: object - an [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/SubmitOrder - https://doc.xt.com/docs/futures/Order/Create%20Orders - https://doc.xt.com/docs/futures/Entrust/CreateTriggerOrders - https://doc.xt.com/docs/futures/Entrust/CreateStopLimit - https://doc.xt.com/docs/futures/Entrust/CreateTrack | 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 exchange API endpoint | | params.timeInForce | string | No | 'GTC', 'IOC', 'FOK', 'PO' or 'GTX' | | params.postOnly | bool | No | true or false whether the order is post-only, mapped to timeInForce 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 | | params.trailingPercent | float | No | the percent to trail away from the current market price, swap markets only | | params.trailingAmount | float | No | the quote amount to trail away from the current market price, swap markets only | | params.trailingTriggerPrice | float | No | the price to activate a trailing order, swap markets only | | params.marginMode | string | No | 'cross' or 'isolated', for trailing orders only, default is 'cross' | ```javascript xt.createOrder (symbol, type, side, amount, price?, params) ``` ### fetchOrder{docsify-ignore} fetches information on an order made by the user **Kind**: instance method of [xt](#xt) **Returns**: object - An [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/GetSingleOrder - https://doc.xt.com/docs/futures/Order/see-orders-by-id - https://doc.xt.com/docs/futures/Entrust/SeeTriggerOrdersByEntrustId - https://doc.xt.com/docs/futures/Entrust/SeeStopLimitByProfitId - https://doc.xt.com/docs/futures/Entrust/GetSingleTrackDetail | 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 exchange 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 | | params.trailing | bool | No | if the order is a trailing order or not | ```javascript xt.fetchOrder (id, symbol?, params) ``` ### fetchOrders{docsify-ignore} fetches information on multiple orders made by the user **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/QueryHistoricalOrders - https://doc.xt.com/docs/futures/Order/see-order-history - https://doc.xt.com/docs/futures/Entrust/SeeTriggerOrdersHistory - https://doc.xt.com/docs/futures/Entrust/GetHistoryTrackListInactive | 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 exchange API endpoint | | params.trigger | bool | No | if the order is a trigger order or not | | params.trailing | bool | No | if the orders are trailing orders or not | ```javascript xt.fetchOrders (symbol?, since?, limit?, params) ``` ### fetchOpenOrders{docsify-ignore} fetch all unfilled currently open orders **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/QueryOpenOrders - https://doc.xt.com/docs/futures/Order/see-orders - https://doc.xt.com/docs/futures/Entrust/SeeTriggerOrders - https://doc.xt.com/docs/futures/Entrust/SeeStopLimit - https://doc.xt.com/docs/futures/Entrust/getTrackList | 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 exchange 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 | | params.trailing | bool | No | if the orders are trailing orders or not | ```javascript xt.fetchOpenOrders (symbol?, since?, limit?, params) ``` ### fetchClosedOrders{docsify-ignore} fetches information on multiple closed orders made by the user **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/QueryHistoricalOrders - https://doc.xt.com/docs/futures/Order/see-orders - https://doc.xt.com/docs/futures/Entrust/SeeTriggerOrders - https://doc.xt.com/docs/futures/Entrust/SeeStopLimit - https://doc.xt.com/docs/futures/Entrust/GetHistoryTrackListInactive | 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 exchange 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 | | params.trailing | bool | No | if the orders are trailing orders or not | ```javascript xt.fetchClosedOrders (symbol?, since?, limit?, params) ``` ### fetchCanceledOrders{docsify-ignore} fetches information on multiple canceled orders made by the user **Kind**: instance method of [xt](#xt) **Returns**: object - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/QueryHistoricalOrders - https://doc.xt.com/docs/futures/Order/see-orders - https://doc.xt.com/docs/futures/Entrust/SeeTriggerOrders - https://doc.xt.com/docs/futures/Entrust/SeeStopLimit - https://doc.xt.com/docs/futures/Entrust/GetHistoryTrackListInactive | 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 exchange 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 | | params.trailing | bool | No | if the orders are trailing orders or not | ```javascript xt.fetchCanceledOrders (symbol?, since?, limit?, params) ``` ### cancelOrder{docsify-ignore} cancels an open order **Kind**: instance method of [xt](#xt) **Returns**: object - An [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/CancelOrder - https://doc.xt.com/docs/futures/Order/cancel-orders - https://doc.xt.com/docs/futures/Entrust/CancelTriggerOrders - https://doc.xt.com/docs/futures/Entrust/CancelStopLimit - https://doc.xt.com/docs/futures/Entrust/CancelSingleTrack | 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 exchange 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 | | params.trailing | bool | No | if the order is a trailing order or not | ```javascript xt.cancelOrder (id, symbol?, params) ``` ### cancelAllOrders{docsify-ignore} cancel all open orders in a market **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See** - https://doc.xt.com/docs/spot/Order/CancelCurrentPendingOrder - https://doc.xt.com/docs/futures/Order/cancel-all-orders - https://doc.xt.com/docs/futures/Entrust/CancelAllTriggerOrders - https://doc.xt.com/docs/futures/Entrust/CancelAllStopLimit - https://doc.xt.com/docs/futures/Entrust/CancelAllTrack | 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 exchange 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 | | params.trailing | bool | No | if the orders are trailing orders or not | ```javascript xt.cancelAllOrders (symbol?, params) ``` ### cancelOrders{docsify-ignore} cancel multiple orders **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) **See**: https://doc.xt.com/docs/spot/Order/CancelBatchOrder | 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 exchange API endpoint | ```javascript xt.cancelOrders (ids, symbol?, params) ``` ### fetchLedger{docsify-ignore} fetch the history of changes, actions done by the user or operations that altered the balance of the user **Kind**: instance method of [xt](#xt) **Returns**: object - a [ledger structure](https://docs.ccxt.com/en/latest/manual.html#ledger-structure) **See**: https://doc.xt.com/docs/futures/User/Get%20User's%20Account%20Flow%20Information | 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 exchange API endpoint | ```javascript xt.fetchLedger (code?, since?, limit?, params) ``` ### fetchDepositAddress{docsify-ignore} fetch the deposit address for a currency associated with this account **Kind**: instance method of [xt](#xt) **Returns**: object - an [address structure](https://docs.ccxt.com/en/latest/manual.html#address-structure) **See**: https://doc.xt.com/docs/spot/Deposit&Withdrawal/GetDepositAddress | Param | Type | Description | | --- | --- | --- | | code | string | unified currency code | | params | object | extra parameters specific to the exchange API endpoint | | params.network | string | required network id | ```javascript xt.fetchDepositAddress (code, params) ``` ### fetchDeposits{docsify-ignore} fetch all deposits made to an account **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) **See**: https://doc.xt.com/docs/spot/Deposit&Withdrawal/GetDepositHistory | 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 exchange API endpoint | ```javascript xt.fetchDeposits (code?, since?, limit?, params) ``` ### fetchWithdrawals{docsify-ignore} fetch all withdrawals made from an account **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) **See**: https://doc.xt.com/docs/spot/Deposit&Withdrawal/WithdrawHistory | 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 exchange API endpoint | ```javascript xt.fetchWithdrawals (code?, since?, limit?, params) ``` ### withdraw{docsify-ignore} make a withdrawal **Kind**: instance method of [xt](#xt) **Returns**: object - a [transaction structure](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) **See**: https://doc.xt.com/docs/spot/Deposit&Withdrawal/Withdraw | 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 exchange API endpoint | ```javascript xt.withdraw (code, amount, address, tag?, params) ``` ### setLeverage{docsify-ignore} set the level of leverage for a market **Kind**: instance method of [xt](#xt) **Returns**: object - response from the exchange **See**: https://doc.xt.com/docs/futures/User/Adjust%20Leverage | Param | Type | Description | | --- | --- | --- | | leverage | float | the rate of leverage | | symbol | string | unified market symbol | | params | object | extra parameters specific to the exchange API endpoint | | params.positionSide | string | 'LONG' or 'SHORT' | ```javascript xt.setLeverage (leverage, symbol, params) ``` ### addMargin{docsify-ignore} add margin to a position **Kind**: instance method of [xt](#xt) **Returns**: object - a [margin structure](https://docs.ccxt.com/?id=margin-structure) **See**: https://doc.xt.com/docs/futures/User/Alter%20Margin | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol | | amount | float | amount of margin to add | | params | object | extra parameters specific to the exchange API endpoint | | params.positionSide | string | 'LONG' or 'SHORT' | ```javascript xt.addMargin (symbol, amount, params) ``` ### reduceMargin{docsify-ignore} remove margin from a position **Kind**: instance method of [xt](#xt) **Returns**: object - a [margin structure](https://docs.ccxt.com/?id=margin-structure) **See**: https://doc.xt.com/docs/futures/User/Alter%20Margin | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol | | amount | float | the amount of margin to remove | | params | object | extra parameters specific to the exchange API endpoint | | params.positionSide | string | 'LONG' or 'SHORT' | ```javascript xt.reduceMargin (symbol, amount, params) ``` ### fetchLeverageTiers{docsify-ignore} retrieve information on the maximum leverage for different trade sizes **Kind**: instance method of [xt](#xt) **Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/?id=leverage-tiers-structure) **See**: https://doc.xt.com/docs/futures/MarketData/see-leverage-stratification-of-single-trading-pair | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | string | No | a list of unified market symbols | | params | object | Yes | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchLeverageTiers (symbols?, params) ``` ### fetchMarketLeverageTiers{docsify-ignore} retrieve information on the maximum leverage for different trade sizes of a single market **Kind**: instance method of [xt](#xt) **Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/?id=leverage-tiers-structure) **See**: https://doc.xt.com/docs/futures/MarketData/see-leverage-stratification-of-single-trading-pair | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchMarketLeverageTiers (symbol, params) ``` ### fetchFundingRateHistory{docsify-ignore} fetches historical funding rates **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/en/latest/manual.html?#funding-rate-history-structure) **See**: https://doc.xt.com/docs/futures/MarketData/get-funding-rate-records | 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 exchange API endpoint | | params.paginate | bool | Yes | true/false whether to use the pagination helper to aumatically paginate through the results | ```javascript xt.fetchFundingRateHistory (symbol?, since?, limit?, params) ``` ### fetchFundingInterval{docsify-ignore} fetch the current funding rate interval **Kind**: instance method of [xt](#xt) **Returns**: object - a [funding rate structure](https://docs.ccxt.com/?id=funding-rate-structure) **See**: https://doc.xt.com/docs/futures/MarketData/get-funding-rate-information | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchFundingInterval (symbol, params?) ``` ### fetchFundingRate{docsify-ignore} fetch the current funding rate **Kind**: instance method of [xt](#xt) **Returns**: object - a [funding rate structure](https://docs.ccxt.com/?id=funding-rate-structure) **See**: https://doc.xt.com/docs/futures/MarketData/get-funding-rate-information | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchFundingRate (symbol, params) ``` ### fetchOpenInterest{docsify-ignore} retrieves the open interest of a contract trading pair **Kind**: instance method of [xt](#xt) **Returns**: object - an [open interest structure](https://docs.ccxt.com/?id=open-interest-structure) **See**: https://doc.xt.com/docs/futures/MarketData/get-the-open-position-of-a-trading-pair | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchOpenInterest (symbol, params?) ``` ### fetchTradingFee{docsify-ignore} fetch the trading fees for a contract market, the same account-level rate applies to all contract markets of the same subtype **Kind**: instance method of [xt](#xt) **Returns**: object - a [fee structure](https://docs.ccxt.com/?id=fee-structure) **See**: https://doc.xt.com/docs/futures/User/Get%20User's%20Step%20Rate | Param | Type | Required | Description | | --- | --- | --- | --- | | symbol | string | Yes | unified market symbol | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchTradingFee (symbol, params?) ``` ### fetchTradingFees{docsify-ignore} fetch the trading fees for multiple markets, the same account-level rate applies to all contract markets of the requested subtype **Kind**: instance method of [xt](#xt) **Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/?id=fee-structure) indexed by market symbol **See**: https://doc.xt.com/docs/futures/User/Get%20User's%20Step%20Rate | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | | params.subType | string | No | 'linear' (default) or 'inverse' | ```javascript xt.fetchTradingFees (params?) ``` ### fetchFundingHistory{docsify-ignore} fetch the funding history **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/?id=funding-history-structure) **See**: https://doc.xt.com/docs/futures/User/Get%20Fund%20Fee%20Information | 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 exchange API endpoint | ```javascript xt.fetchFundingHistory (symbol, since?, limit?, params) ``` ### fetchPosition{docsify-ignore} fetch data on a single open contract trade position **Kind**: instance method of [xt](#xt) **Returns**: object - a [position structure](https://docs.ccxt.com/?id=position-structure) **See** - https://doc.xt.com/docs/futures/User/Get%20Position%20Information - https://doc.xt.com/docs/futures/User/Get%20Margin%20Call%20Information | Param | Type | Description | | --- | --- | --- | | symbol | string | unified market symbol of the market the position is held in | | params | object | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchPosition (symbol, params) ``` ### fetchPositions{docsify-ignore} fetch all open positions **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/?id=position-structure) **See** - https://doc.xt.com/docs/futures/User/Get%20Position%20Information - https://doc.xt.com/docs/futures/User/Get%20Margin%20Call%20Information | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | string | No | list of unified market symbols, not supported with xt | | params | object | Yes | extra parameters specific to the exchange API endpoint | ```javascript xt.fetchPositions (symbols?, params) ``` ### fetchPositionsHistory{docsify-ignore} fetches historical closed positions **Kind**: instance method of [xt](#xt) **Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/?id=position-structure) **See**: https://doc.xt.com/docs/futures/Entrust/GetPositionHistory | Param | Type | Required | Description | | --- | --- | --- | --- | | symbols | Array<string> | No | unified market symbols, all closed positions are returned if not assigned | | since | int | No | timestamp in ms of the earliest position to fetch | | limit | int | No | the maximum amount of records to fetch, default=10 | | params | object | Yes | extra parameters specific to the exchange API endpoint | | params.until | int | No | timestamp in ms of the latest position to fetch | ```javascript xt.fetchPositionsHistory (symbols?, since?, limit?, params) ``` ### transfer{docsify-ignore} transfer currency internally between wallets on the same account **Kind**: instance method of [xt](#xt) **Returns**: object - a [transfer structure](https://docs.ccxt.com/?id=transfer-structure) **See**: https://doc.xt.com/docs/spot/Transfer/TransferBetweenUserSystems | 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 exchange API endpoint | ```javascript xt.transfer (code, amount, fromAccount, toAccount, params) ``` ### setMarginMode{docsify-ignore} set margin mode to 'cross' or 'isolated' **Kind**: instance method of [xt](#xt) **Returns**: object - response from the exchange **See**: https://doc.xt.com/docs/futures/User/Change%20Position%20Type | 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" | ```javascript xt.setMarginMode (marginMode, symbol?, params?) ``` ### editOrder{docsify-ignore} cancels an order and places a new order **Kind**: instance method of [xt](#xt) **Returns**: object - an [order structure](https://docs.ccxt.com/?id=order-structure) **See** - https://doc.xt.com/docs/spot/Order/UpdateOrderLimit - https://doc.xt.com/docs/futures/Order/update-orders - https://doc.xt.com/docs/futures/Entrust/AlterStopLimit | 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 | ```javascript xt.editOrder (id, symbol, type, side, amount, price?, params?) ```