ccxt 4.3.43 → 4.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/lykke.js +10 -2
- package/dist/cjs/src/ndax.js +5 -1
- package/dist/cjs/src/poloniexfutures.js +2 -2
- package/dist/cjs/src/pro/bitmex.js +9 -0
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/xt.js +134 -95
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/xt.d.ts +155 -0
- package/js/src/abstract/xt.js +11 -0
- package/js/src/lykke.d.ts +2 -2
- package/js/src/lykke.js +10 -2
- package/js/src/ndax.d.ts +1 -1
- package/js/src/ndax.js +5 -1
- package/js/src/poloniexfutures.js +2 -2
- package/js/src/pro/bitmex.js +9 -0
- package/js/src/pro/woo.js +1 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/xt.d.ts +161 -0
- package/js/src/xt.js +4761 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -114,6 +114,7 @@ var wazirx = require('./src/wazirx.js');
|
|
|
114
114
|
var whitebit = require('./src/whitebit.js');
|
|
115
115
|
var woo = require('./src/woo.js');
|
|
116
116
|
var woofipro = require('./src/woofipro.js');
|
|
117
|
+
var xt = require('./src/xt.js');
|
|
117
118
|
var yobit = require('./src/yobit.js');
|
|
118
119
|
var zaif = require('./src/zaif.js');
|
|
119
120
|
var zonda = require('./src/zonda.js');
|
|
@@ -185,7 +186,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
185
186
|
|
|
186
187
|
//-----------------------------------------------------------------------------
|
|
187
188
|
// this is updated by vss.js when building
|
|
188
|
-
const version = '4.3.
|
|
189
|
+
const version = '4.3.44';
|
|
189
190
|
Exchange["default"].ccxtVersion = version;
|
|
190
191
|
const exchanges = {
|
|
191
192
|
'ace': ace,
|
|
@@ -290,6 +291,7 @@ const exchanges = {
|
|
|
290
291
|
'whitebit': whitebit,
|
|
291
292
|
'woo': woo,
|
|
292
293
|
'woofipro': woofipro,
|
|
294
|
+
'xt': xt,
|
|
293
295
|
'yobit': yobit,
|
|
294
296
|
'zaif': zaif,
|
|
295
297
|
'zonda': zonda,
|
|
@@ -510,6 +512,7 @@ exports.wazirx = wazirx;
|
|
|
510
512
|
exports.whitebit = whitebit;
|
|
511
513
|
exports.woo = woo;
|
|
512
514
|
exports.woofipro = woofipro;
|
|
515
|
+
exports.xt = xt;
|
|
513
516
|
exports.yobit = yobit;
|
|
514
517
|
exports.zaif = zaif;
|
|
515
518
|
exports.zonda = zonda;
|
package/dist/cjs/src/lykke.js
CHANGED
|
@@ -880,7 +880,10 @@ class lykke extends lykke$1 {
|
|
|
880
880
|
// "error":null
|
|
881
881
|
// }
|
|
882
882
|
//
|
|
883
|
-
|
|
883
|
+
const response = await this.privateDeleteOrdersOrderId(this.extend(request, params));
|
|
884
|
+
return this.safeOrder({
|
|
885
|
+
'info': response,
|
|
886
|
+
});
|
|
884
887
|
}
|
|
885
888
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
886
889
|
/**
|
|
@@ -907,7 +910,12 @@ class lykke extends lykke$1 {
|
|
|
907
910
|
// "error":null
|
|
908
911
|
// }
|
|
909
912
|
//
|
|
910
|
-
|
|
913
|
+
const response = await this.privateDeleteOrders(this.extend(request, params));
|
|
914
|
+
return [
|
|
915
|
+
this.safeOrder({
|
|
916
|
+
'info': response,
|
|
917
|
+
}),
|
|
918
|
+
];
|
|
911
919
|
}
|
|
912
920
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
913
921
|
/**
|
package/dist/cjs/src/ndax.js
CHANGED
|
@@ -1572,7 +1572,11 @@ class ndax extends ndax$1 {
|
|
|
1572
1572
|
// "detail":null
|
|
1573
1573
|
// }
|
|
1574
1574
|
//
|
|
1575
|
-
return
|
|
1575
|
+
return [
|
|
1576
|
+
this.safeOrder({
|
|
1577
|
+
'info': response,
|
|
1578
|
+
}),
|
|
1579
|
+
];
|
|
1576
1580
|
}
|
|
1577
1581
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1578
1582
|
/**
|
|
@@ -1236,7 +1236,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
1236
1236
|
const cancelledOrderIdsLength = cancelledOrderIds.length;
|
|
1237
1237
|
for (let i = 0; i < cancelledOrderIdsLength; i++) {
|
|
1238
1238
|
const cancelledOrderId = this.safeString(cancelledOrderIds, i);
|
|
1239
|
-
result.push({
|
|
1239
|
+
result.push(this.safeOrder({
|
|
1240
1240
|
'id': cancelledOrderId,
|
|
1241
1241
|
'clientOrderId': undefined,
|
|
1242
1242
|
'timestamp': undefined,
|
|
@@ -1258,7 +1258,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
1258
1258
|
'postOnly': undefined,
|
|
1259
1259
|
'stopPrice': undefined,
|
|
1260
1260
|
'info': response,
|
|
1261
|
-
});
|
|
1261
|
+
}));
|
|
1262
1262
|
}
|
|
1263
1263
|
return result;
|
|
1264
1264
|
}
|
|
@@ -1534,11 +1534,17 @@ class bitmex extends bitmex$1 {
|
|
|
1534
1534
|
//
|
|
1535
1535
|
const action = this.safeString(message, 'action');
|
|
1536
1536
|
const table = this.safeString(message, 'table');
|
|
1537
|
+
if (table === undefined) {
|
|
1538
|
+
return; // protecting from weird updates
|
|
1539
|
+
}
|
|
1537
1540
|
const data = this.safeValue(message, 'data', []);
|
|
1538
1541
|
// if it's an initial snapshot
|
|
1539
1542
|
if (action === 'partial') {
|
|
1540
1543
|
const filter = this.safeDict(message, 'filter', {});
|
|
1541
1544
|
const marketId = this.safeValue(filter, 'symbol');
|
|
1545
|
+
if (marketId === undefined) {
|
|
1546
|
+
return; // protecting from weird update
|
|
1547
|
+
}
|
|
1542
1548
|
const market = this.safeMarket(marketId);
|
|
1543
1549
|
const symbol = market['symbol'];
|
|
1544
1550
|
if (table === 'orderBookL2') {
|
|
@@ -1571,6 +1577,9 @@ class bitmex extends bitmex$1 {
|
|
|
1571
1577
|
const numUpdatesByMarketId = {};
|
|
1572
1578
|
for (let i = 0; i < data.length; i++) {
|
|
1573
1579
|
const marketId = this.safeValue(data[i], 'symbol');
|
|
1580
|
+
if (marketId === undefined) {
|
|
1581
|
+
return; // protecting from weird update
|
|
1582
|
+
}
|
|
1574
1583
|
if (!(marketId in numUpdatesByMarketId)) {
|
|
1575
1584
|
numUpdatesByMarketId[marketId] = 0;
|
|
1576
1585
|
}
|
package/dist/cjs/src/pro/woo.js
CHANGED
package/dist/cjs/src/xt.js
CHANGED
|
@@ -35,6 +35,8 @@ class xt extends xt$1 {
|
|
|
35
35
|
'cancelOrder': true,
|
|
36
36
|
'cancelOrders': true,
|
|
37
37
|
'createDepositAddress': false,
|
|
38
|
+
'createMarketBuyOrderWithCost': true,
|
|
39
|
+
'createMarketSellOrderWithCost': false,
|
|
38
40
|
'createOrder': true,
|
|
39
41
|
'createPostOnlyOrder': false,
|
|
40
42
|
'createReduceOnlyOrder': true,
|
|
@@ -851,7 +853,7 @@ class xt extends xt$1 {
|
|
|
851
853
|
* @see https://doc.xt.com/#market2symbol
|
|
852
854
|
* @see https://doc.xt.com/#futures_quotesgetSymbols
|
|
853
855
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
854
|
-
* @returns {[
|
|
856
|
+
* @returns {object[]} an array of objects representing market data
|
|
855
857
|
*/
|
|
856
858
|
if (this.options['adjustForTimeDifference']) {
|
|
857
859
|
await this.loadTimeDifference();
|
|
@@ -1197,7 +1199,7 @@ class xt extends xt$1 {
|
|
|
1197
1199
|
isActive = true;
|
|
1198
1200
|
}
|
|
1199
1201
|
}
|
|
1200
|
-
return {
|
|
1202
|
+
return this.safeMarketStructure({
|
|
1201
1203
|
'id': id,
|
|
1202
1204
|
'symbol': symbol,
|
|
1203
1205
|
'base': base,
|
|
@@ -1248,7 +1250,7 @@ class xt extends xt$1 {
|
|
|
1248
1250
|
},
|
|
1249
1251
|
},
|
|
1250
1252
|
'info': market,
|
|
1251
|
-
};
|
|
1253
|
+
});
|
|
1252
1254
|
}
|
|
1253
1255
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
1254
1256
|
/**
|
|
@@ -1259,10 +1261,10 @@ class xt extends xt$1 {
|
|
|
1259
1261
|
* @see https://doc.xt.com/#futures_quotesgetKLine
|
|
1260
1262
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1261
1263
|
* @param {string} timeframe the length of time each candle represents
|
|
1262
|
-
* @param {int
|
|
1263
|
-
* @param {int
|
|
1264
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
1265
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
1264
1266
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1265
|
-
* @returns {[[
|
|
1267
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
1266
1268
|
*/
|
|
1267
1269
|
await this.loadMarkets();
|
|
1268
1270
|
const market = this.market(symbol);
|
|
@@ -1376,7 +1378,7 @@ class xt extends xt$1 {
|
|
|
1376
1378
|
* @see https://doc.xt.com/#futures_quotesgetDepth
|
|
1377
1379
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1378
1380
|
* @param {string} symbol unified market symbol to fetch the order book for
|
|
1379
|
-
* @param {int
|
|
1381
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1380
1382
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1381
1383
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-book-structure} indexed by market symbols
|
|
1382
1384
|
*/
|
|
@@ -1544,7 +1546,7 @@ class xt extends xt$1 {
|
|
|
1544
1546
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
1545
1547
|
* @see https://doc.xt.com/#market10ticker24h
|
|
1546
1548
|
* @see https://doc.xt.com/#futures_quotesgetAggTickers
|
|
1547
|
-
* @param {
|
|
1549
|
+
* @param {string} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1548
1550
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1549
1551
|
* @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/en/latest/manual.html#ticker-structure}
|
|
1550
1552
|
*/
|
|
@@ -1632,7 +1634,7 @@ class xt extends xt$1 {
|
|
|
1632
1634
|
* @name xt#fetchBidsAsks
|
|
1633
1635
|
* @description fetches the bid and ask price and volume for multiple markets
|
|
1634
1636
|
* @see https://doc.xt.com/#market9tickerBook
|
|
1635
|
-
* @param {
|
|
1637
|
+
* @param {string} [symbols] unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
1636
1638
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1637
1639
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/en/latest/manual.html#ticker-structure}
|
|
1638
1640
|
*/
|
|
@@ -1754,10 +1756,10 @@ class xt extends xt$1 {
|
|
|
1754
1756
|
* @see https://doc.xt.com/#market5tradeRecent
|
|
1755
1757
|
* @see https://doc.xt.com/#futures_quotesgetDeal
|
|
1756
1758
|
* @param {string} symbol unified market symbol to fetch trades for
|
|
1757
|
-
* @param {int
|
|
1758
|
-
* @param {int
|
|
1759
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1760
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
1759
1761
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1760
|
-
* @returns {[
|
|
1762
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
|
|
1761
1763
|
*/
|
|
1762
1764
|
await this.loadMarkets();
|
|
1763
1765
|
const market = this.market(symbol);
|
|
@@ -1828,11 +1830,11 @@ class xt extends xt$1 {
|
|
|
1828
1830
|
* @description fetch all trades made by the user
|
|
1829
1831
|
* @see https://doc.xt.com/#tradetradeGet
|
|
1830
1832
|
* @see https://doc.xt.com/#futures_ordergetTrades
|
|
1831
|
-
* @param {string
|
|
1832
|
-
* @param {int
|
|
1833
|
-
* @param {int
|
|
1833
|
+
* @param {string} [symbol] unified market symbol to fetch trades for
|
|
1834
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1835
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
1834
1836
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
1835
|
-
* @returns {[
|
|
1837
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
|
|
1836
1838
|
*/
|
|
1837
1839
|
await this.loadMarkets();
|
|
1838
1840
|
const request = {};
|
|
@@ -2166,6 +2168,24 @@ class xt extends xt$1 {
|
|
|
2166
2168
|
}
|
|
2167
2169
|
return this.safeBalance(result);
|
|
2168
2170
|
}
|
|
2171
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2172
|
+
/**
|
|
2173
|
+
* @method
|
|
2174
|
+
* @name xt#createMarketBuyOrderWithCost
|
|
2175
|
+
* @see https://doc.xt.com/#orderorderPost
|
|
2176
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2177
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2178
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2179
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2180
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2181
|
+
*/
|
|
2182
|
+
await this.loadMarkets();
|
|
2183
|
+
const market = this.market(symbol);
|
|
2184
|
+
if (!market['spot']) {
|
|
2185
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
2186
|
+
}
|
|
2187
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
2188
|
+
}
|
|
2169
2189
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2170
2190
|
/**
|
|
2171
2191
|
* @method
|
|
@@ -2179,14 +2199,14 @@ class xt extends xt$1 {
|
|
|
2179
2199
|
* @param {string} type 'market' or 'limit'
|
|
2180
2200
|
* @param {string} side 'buy' or 'sell'
|
|
2181
2201
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
2182
|
-
* @param {float
|
|
2202
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, can be ignored in market orders
|
|
2183
2203
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
2184
|
-
* @param {string
|
|
2185
|
-
* @param {string
|
|
2186
|
-
* @param {string
|
|
2187
|
-
* @param {float
|
|
2188
|
-
* @param {float
|
|
2189
|
-
* @param {float
|
|
2204
|
+
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'FOK' or 'GTX'
|
|
2205
|
+
* @param {string} [params.entrustType] 'TAKE_PROFIT', 'STOP', 'TAKE_PROFIT_MARKET', 'STOP_MARKET', 'TRAILING_STOP_MARKET', required if stopPrice is defined, currently isn't functioning on xt's side
|
|
2206
|
+
* @param {string} [params.triggerPriceType] 'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined
|
|
2207
|
+
* @param {float} [params.stopPrice] price to trigger a stop order
|
|
2208
|
+
* @param {float} [params.stopLoss] price to set a stop-loss on an open position
|
|
2209
|
+
* @param {float} [params.takeProfit] price to set a take-profit on an open position
|
|
2190
2210
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
2191
2211
|
*/
|
|
2192
2212
|
await this.loadMarkets();
|
|
@@ -2215,20 +2235,29 @@ class xt extends xt$1 {
|
|
|
2215
2235
|
if (type === 'market') {
|
|
2216
2236
|
timeInForce = this.safeStringUpper(params, 'timeInForce', 'FOK');
|
|
2217
2237
|
if (side === 'buy') {
|
|
2218
|
-
const
|
|
2238
|
+
const cost = this.safeString(params, 'cost');
|
|
2239
|
+
params = this.omit(params, 'cost');
|
|
2240
|
+
const createMarketBuyOrderRequiresPrice = this.safeBool(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
2219
2241
|
if (createMarketBuyOrderRequiresPrice) {
|
|
2220
|
-
if (price === undefined) {
|
|
2221
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
|
|
2242
|
+
if (price === undefined && (cost === undefined)) {
|
|
2243
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument or cost in params for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
|
|
2222
2244
|
}
|
|
2223
2245
|
else {
|
|
2224
2246
|
const amountString = this.numberToString(amount);
|
|
2225
2247
|
const priceString = this.numberToString(price);
|
|
2226
|
-
|
|
2227
|
-
|
|
2248
|
+
let costCalculated = undefined;
|
|
2249
|
+
if (price !== undefined) {
|
|
2250
|
+
costCalculated = Precise["default"].stringMul(amountString, priceString);
|
|
2251
|
+
}
|
|
2252
|
+
else {
|
|
2253
|
+
costCalculated = cost;
|
|
2254
|
+
}
|
|
2255
|
+
request['quoteQty'] = this.costToPrecision(symbol, costCalculated);
|
|
2228
2256
|
}
|
|
2229
2257
|
}
|
|
2230
2258
|
else {
|
|
2231
|
-
|
|
2259
|
+
const amountCost = (cost !== undefined) ? cost : amount;
|
|
2260
|
+
request['quoteQty'] = this.costToPrecision(symbol, amountCost);
|
|
2232
2261
|
}
|
|
2233
2262
|
}
|
|
2234
2263
|
}
|
|
@@ -2346,10 +2375,10 @@ class xt extends xt$1 {
|
|
|
2346
2375
|
* @see https://doc.xt.com/#futures_entrustgetPlanById
|
|
2347
2376
|
* @see https://doc.xt.com/#futures_entrustgetProfitById
|
|
2348
2377
|
* @param {string} id order id
|
|
2349
|
-
* @param {string
|
|
2378
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
2350
2379
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
2351
|
-
* @param {bool
|
|
2352
|
-
* @param {bool
|
|
2380
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
2381
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
2353
2382
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
2354
2383
|
*/
|
|
2355
2384
|
await this.loadMarkets();
|
|
@@ -2529,12 +2558,12 @@ class xt extends xt$1 {
|
|
|
2529
2558
|
* @see https://doc.xt.com/#orderhistoryOrderGet
|
|
2530
2559
|
* @see https://doc.xt.com/#futures_ordergetHistory
|
|
2531
2560
|
* @see https://doc.xt.com/#futures_entrustgetPlanHistory
|
|
2532
|
-
* @param {string
|
|
2533
|
-
* @param {int
|
|
2534
|
-
* @param {int
|
|
2561
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
2562
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
2563
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
2535
2564
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
2536
|
-
* @param {bool
|
|
2537
|
-
* @returns {[
|
|
2565
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
2566
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
2538
2567
|
*/
|
|
2539
2568
|
await this.loadMarkets();
|
|
2540
2569
|
const request = {};
|
|
@@ -2977,13 +3006,13 @@ class xt extends xt$1 {
|
|
|
2977
3006
|
* @see https://doc.xt.com/#futures_ordergetOrders
|
|
2978
3007
|
* @see https://doc.xt.com/#futures_entrustgetPlan
|
|
2979
3008
|
* @see https://doc.xt.com/#futures_entrustgetProfit
|
|
2980
|
-
* @param {string
|
|
2981
|
-
* @param {int
|
|
2982
|
-
* @param {int
|
|
3009
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
3010
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
3011
|
+
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
2983
3012
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
2984
|
-
* @param {bool
|
|
2985
|
-
* @param {bool
|
|
2986
|
-
* @returns {[
|
|
3013
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
3014
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
3015
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
2987
3016
|
*/
|
|
2988
3017
|
return await this.fetchOrdersByStatus('open', symbol, since, limit, params);
|
|
2989
3018
|
}
|
|
@@ -2996,13 +3025,13 @@ class xt extends xt$1 {
|
|
|
2996
3025
|
* @see https://doc.xt.com/#futures_ordergetOrders
|
|
2997
3026
|
* @see https://doc.xt.com/#futures_entrustgetPlan
|
|
2998
3027
|
* @see https://doc.xt.com/#futures_entrustgetProfit
|
|
2999
|
-
* @param {string
|
|
3000
|
-
* @param {int
|
|
3001
|
-
* @param {int
|
|
3028
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
3029
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
3030
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3002
3031
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3003
|
-
* @param {bool
|
|
3004
|
-
* @param {bool
|
|
3005
|
-
* @returns {[
|
|
3032
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
3033
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
3034
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
3006
3035
|
*/
|
|
3007
3036
|
return await this.fetchOrdersByStatus('closed', symbol, since, limit, params);
|
|
3008
3037
|
}
|
|
@@ -3015,12 +3044,12 @@ class xt extends xt$1 {
|
|
|
3015
3044
|
* @see https://doc.xt.com/#futures_ordergetOrders
|
|
3016
3045
|
* @see https://doc.xt.com/#futures_entrustgetPlan
|
|
3017
3046
|
* @see https://doc.xt.com/#futures_entrustgetProfit
|
|
3018
|
-
* @param {string
|
|
3019
|
-
* @param {int
|
|
3020
|
-
* @param {int
|
|
3047
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
3048
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
3049
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
3021
3050
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3022
|
-
* @param {bool
|
|
3023
|
-
* @param {bool
|
|
3051
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
3052
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
3024
3053
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
3025
3054
|
*/
|
|
3026
3055
|
return await this.fetchOrdersByStatus('canceled', symbol, since, limit, params);
|
|
@@ -3035,10 +3064,10 @@ class xt extends xt$1 {
|
|
|
3035
3064
|
* @see https://doc.xt.com/#futures_entrustcancelPlan
|
|
3036
3065
|
* @see https://doc.xt.com/#futures_entrustcancelProfit
|
|
3037
3066
|
* @param {string} id order id
|
|
3038
|
-
* @param {string
|
|
3067
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
3039
3068
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3040
|
-
* @param {bool
|
|
3041
|
-
* @param {bool
|
|
3069
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
3070
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
3042
3071
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
3043
3072
|
*/
|
|
3044
3073
|
await this.loadMarkets();
|
|
@@ -3124,11 +3153,11 @@ class xt extends xt$1 {
|
|
|
3124
3153
|
* @see https://doc.xt.com/#futures_ordercancelBatch
|
|
3125
3154
|
* @see https://doc.xt.com/#futures_entrustcancelPlanBatch
|
|
3126
3155
|
* @see https://doc.xt.com/#futures_entrustcancelProfitBatch
|
|
3127
|
-
* @param {string
|
|
3156
|
+
* @param {string} [symbol] unified market symbol of the market to cancel orders in
|
|
3128
3157
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3129
|
-
* @param {bool
|
|
3130
|
-
* @param {bool
|
|
3131
|
-
* @returns {[
|
|
3158
|
+
* @param {bool} [params.stop] if the order is a stop trigger order or not
|
|
3159
|
+
* @param {bool} [params.stopLossTakeProfit] if the order is a stop-loss or take-profit order
|
|
3160
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
3132
3161
|
*/
|
|
3133
3162
|
await this.loadMarkets();
|
|
3134
3163
|
const request = {};
|
|
@@ -3194,7 +3223,9 @@ class xt extends xt$1 {
|
|
|
3194
3223
|
// "result": true
|
|
3195
3224
|
// }
|
|
3196
3225
|
//
|
|
3197
|
-
return
|
|
3226
|
+
return [
|
|
3227
|
+
this.safeOrder(response),
|
|
3228
|
+
];
|
|
3198
3229
|
}
|
|
3199
3230
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
3200
3231
|
/**
|
|
@@ -3202,10 +3233,10 @@ class xt extends xt$1 {
|
|
|
3202
3233
|
* @name xt#cancelOrders
|
|
3203
3234
|
* @description cancel multiple orders
|
|
3204
3235
|
* @see https://doc.xt.com/#orderbatchOrderDel
|
|
3205
|
-
* @param {[
|
|
3206
|
-
* @param {string
|
|
3236
|
+
* @param {string[]} ids order ids
|
|
3237
|
+
* @param {string} [symbol] unified market symbol of the market to cancel orders in
|
|
3207
3238
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3208
|
-
* @returns {[
|
|
3239
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
3209
3240
|
*/
|
|
3210
3241
|
await this.loadMarkets();
|
|
3211
3242
|
const request = {
|
|
@@ -3231,7 +3262,9 @@ class xt extends xt$1 {
|
|
|
3231
3262
|
// "result": null
|
|
3232
3263
|
// }
|
|
3233
3264
|
//
|
|
3234
|
-
return
|
|
3265
|
+
return [
|
|
3266
|
+
this.safeOrder(response),
|
|
3267
|
+
];
|
|
3235
3268
|
}
|
|
3236
3269
|
parseOrder(order, market = undefined) {
|
|
3237
3270
|
//
|
|
@@ -3416,9 +3449,9 @@ class xt extends xt$1 {
|
|
|
3416
3449
|
* @name xt#fetchLedger
|
|
3417
3450
|
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
3418
3451
|
* @see https://doc.xt.com/#futures_usergetBalanceBill
|
|
3419
|
-
* @param {string
|
|
3420
|
-
* @param {int
|
|
3421
|
-
* @param {int
|
|
3452
|
+
* @param {string} [code] unified currency code
|
|
3453
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
3454
|
+
* @param {int} [limit] max number of ledger entries to return
|
|
3422
3455
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3423
3456
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/en/latest/manual.html#ledger-structure}
|
|
3424
3457
|
*/
|
|
@@ -3585,11 +3618,11 @@ class xt extends xt$1 {
|
|
|
3585
3618
|
* @name xt#fetchDeposits
|
|
3586
3619
|
* @description fetch all deposits made to an account
|
|
3587
3620
|
* @see https://doc.xt.com/#deposit_withdrawalhistoryDepositGet
|
|
3588
|
-
* @param {string
|
|
3589
|
-
* @param {int
|
|
3590
|
-
* @param {int
|
|
3621
|
+
* @param {string} [code] unified currency code
|
|
3622
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
3623
|
+
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
3591
3624
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3592
|
-
* @returns {[
|
|
3625
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/en/latest/manual.html#transaction-structure}
|
|
3593
3626
|
*/
|
|
3594
3627
|
await this.loadMarkets();
|
|
3595
3628
|
const request = {};
|
|
@@ -3641,11 +3674,11 @@ class xt extends xt$1 {
|
|
|
3641
3674
|
* @name xt#fetchWithdrawals
|
|
3642
3675
|
* @description fetch all withdrawals made from an account
|
|
3643
3676
|
* @see https://doc.xt.com/#deposit_withdrawalwithdrawHistory
|
|
3644
|
-
* @param {string
|
|
3645
|
-
* @param {int
|
|
3646
|
-
* @param {int
|
|
3677
|
+
* @param {string} [code] unified currency code
|
|
3678
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
3679
|
+
* @param {int} [limit] the maximum number of transaction structures to retrieve
|
|
3647
3680
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3648
|
-
* @returns {[
|
|
3681
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/en/latest/manual.html#transaction-structure}
|
|
3649
3682
|
*/
|
|
3650
3683
|
await this.loadMarkets();
|
|
3651
3684
|
const request = {};
|
|
@@ -3700,7 +3733,7 @@ class xt extends xt$1 {
|
|
|
3700
3733
|
* @param {string} code unified currency code
|
|
3701
3734
|
* @param {float} amount the amount to withdraw
|
|
3702
3735
|
* @param {string} address the address to withdraw to
|
|
3703
|
-
* @param {string
|
|
3736
|
+
* @param {string} [tag]
|
|
3704
3737
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3705
3738
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/en/latest/manual.html#transaction-structure}
|
|
3706
3739
|
*/
|
|
@@ -3807,6 +3840,7 @@ class xt extends xt$1 {
|
|
|
3807
3840
|
'cost': fee,
|
|
3808
3841
|
'rate': undefined,
|
|
3809
3842
|
},
|
|
3843
|
+
'internal': undefined,
|
|
3810
3844
|
};
|
|
3811
3845
|
}
|
|
3812
3846
|
parseTransactionStatus(status) {
|
|
@@ -3833,7 +3867,9 @@ class xt extends xt$1 {
|
|
|
3833
3867
|
* @param {string} params.positionSide 'LONG' or 'SHORT'
|
|
3834
3868
|
* @returns {object} response from the exchange
|
|
3835
3869
|
*/
|
|
3836
|
-
|
|
3870
|
+
if (symbol === undefined) {
|
|
3871
|
+
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
3872
|
+
}
|
|
3837
3873
|
const positionSide = this.safeString(params, 'positionSide');
|
|
3838
3874
|
this.checkRequiredArgument('setLeverage', positionSide, 'positionSide', ['LONG', 'SHORT']);
|
|
3839
3875
|
if ((leverage < 1) || (leverage > 125)) {
|
|
@@ -3934,6 +3970,10 @@ class xt extends xt$1 {
|
|
|
3934
3970
|
'code': undefined,
|
|
3935
3971
|
'symbol': this.safeSymbol(undefined, market),
|
|
3936
3972
|
'status': undefined,
|
|
3973
|
+
'marginMode': undefined,
|
|
3974
|
+
'total': undefined,
|
|
3975
|
+
'timestamp': undefined,
|
|
3976
|
+
'datetime': undefined,
|
|
3937
3977
|
};
|
|
3938
3978
|
}
|
|
3939
3979
|
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
@@ -3942,7 +3982,7 @@ class xt extends xt$1 {
|
|
|
3942
3982
|
* @name xt#fetchLeverageTiers
|
|
3943
3983
|
* @see https://doc.xt.com/#futures_quotesgetLeverageBrackets
|
|
3944
3984
|
* @description retrieve information on the maximum leverage for different trade sizes
|
|
3945
|
-
* @param {
|
|
3985
|
+
* @param {string} [symbols] a list of unified market symbols
|
|
3946
3986
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
3947
3987
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
3948
3988
|
*/
|
|
@@ -4110,13 +4150,15 @@ class xt extends xt$1 {
|
|
|
4110
4150
|
* @name xt#fetchFundingRateHistory
|
|
4111
4151
|
* @description fetches historical funding rates
|
|
4112
4152
|
* @see https://doc.xt.com/#futures_quotesgetFundingRateRecord
|
|
4113
|
-
* @param {string
|
|
4114
|
-
* @param {int
|
|
4115
|
-
* @param {int
|
|
4153
|
+
* @param {string} [symbol] unified symbol of the market to fetch the funding rate history for
|
|
4154
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
4155
|
+
* @param {int} [limit] the maximum amount of [funding rate structures] to fetch
|
|
4116
4156
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
4117
|
-
* @returns {[
|
|
4157
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/en/latest/manual.html?#funding-rate-history-structure}
|
|
4118
4158
|
*/
|
|
4119
|
-
|
|
4159
|
+
if (symbol === undefined) {
|
|
4160
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
4161
|
+
}
|
|
4120
4162
|
await this.loadMarkets();
|
|
4121
4163
|
const market = this.market(symbol);
|
|
4122
4164
|
if (!market['swap']) {
|
|
@@ -4251,17 +4293,17 @@ class xt extends xt$1 {
|
|
|
4251
4293
|
'previousFundingDatetime': undefined,
|
|
4252
4294
|
};
|
|
4253
4295
|
}
|
|
4254
|
-
async fetchFundingHistory(symbol, since = undefined, limit = undefined, params = {}) {
|
|
4296
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4255
4297
|
/**
|
|
4256
4298
|
* @method
|
|
4257
4299
|
* @name xt#fetchFundingHistory
|
|
4258
4300
|
* @description fetch the funding history
|
|
4259
4301
|
* @see https://doc.xt.com/#futures_usergetFunding
|
|
4260
4302
|
* @param {string} symbol unified market symbol
|
|
4261
|
-
* @param {int
|
|
4262
|
-
* @param {int
|
|
4303
|
+
* @param {int} [since] the starting timestamp in milliseconds
|
|
4304
|
+
* @param {int} [limit] the number of entries to return
|
|
4263
4305
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
4264
|
-
* @returns {[
|
|
4306
|
+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
4265
4307
|
*/
|
|
4266
4308
|
await this.loadMarkets();
|
|
4267
4309
|
const market = this.market(symbol);
|
|
@@ -4410,14 +4452,11 @@ class xt extends xt$1 {
|
|
|
4410
4452
|
* @name xt#fetchPositions
|
|
4411
4453
|
* @description fetch all open positions
|
|
4412
4454
|
* @see https://doc.xt.com/#futures_usergetPosition
|
|
4413
|
-
* @param {
|
|
4455
|
+
* @param {string} [symbols] list of unified market symbols, not supported with xt
|
|
4414
4456
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
4415
|
-
* @returns {[
|
|
4457
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
4416
4458
|
*/
|
|
4417
4459
|
await this.loadMarkets();
|
|
4418
|
-
if (symbols !== undefined) {
|
|
4419
|
-
throw new errors.BadRequest(this.id + ' fetchPositions() only supports the symbols argument as undefined');
|
|
4420
|
-
}
|
|
4421
4460
|
let subType = undefined;
|
|
4422
4461
|
[subType, params] = this.handleSubTypeAndParams('fetchPositions', undefined, params);
|
|
4423
4462
|
let response = undefined;
|
|
@@ -4460,7 +4499,7 @@ class xt extends xt$1 {
|
|
|
4460
4499
|
const marketInner = this.safeMarket(marketId, undefined, undefined, 'contract');
|
|
4461
4500
|
result.push(this.parsePosition(entry, marketInner));
|
|
4462
4501
|
}
|
|
4463
|
-
return this.
|
|
4502
|
+
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
4464
4503
|
}
|
|
4465
4504
|
parsePosition(position, market = undefined) {
|
|
4466
4505
|
//
|