ccxt 4.3.42 → 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.
Files changed (52) hide show
  1. package/README.md +9 -7
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/binance.js +169 -44
  5. package/dist/cjs/src/btcmarkets.js +31 -2
  6. package/dist/cjs/src/coinex.js +106 -107
  7. package/dist/cjs/src/lykke.js +10 -2
  8. package/dist/cjs/src/ndax.js +5 -1
  9. package/dist/cjs/src/phemex.js +5 -4
  10. package/dist/cjs/src/poloniexfutures.js +2 -2
  11. package/dist/cjs/src/pro/bitget.js +28 -21
  12. package/dist/cjs/src/pro/bitmex.js +9 -0
  13. package/dist/cjs/src/pro/bybit.js +1 -1
  14. package/dist/cjs/src/pro/mexc.js +1 -1
  15. package/dist/cjs/src/pro/woo.js +1 -1
  16. package/dist/cjs/src/tradeogre.js +11 -5
  17. package/dist/cjs/src/wavesexchange.js +2 -2
  18. package/dist/cjs/src/wazirx.js +38 -15
  19. package/dist/cjs/src/xt.js +134 -95
  20. package/dist/cjs/src/zonda.js +9 -1
  21. package/js/ccxt.d.ts +6 -3
  22. package/js/ccxt.js +4 -2
  23. package/js/src/abstract/coinex.d.ts +2 -1
  24. package/js/src/abstract/xt.d.ts +155 -0
  25. package/js/src/abstract/xt.js +11 -0
  26. package/js/src/binance.js +169 -44
  27. package/js/src/btcmarkets.d.ts +2 -2
  28. package/js/src/btcmarkets.js +31 -2
  29. package/js/src/coinex.js +106 -107
  30. package/js/src/lykke.d.ts +2 -2
  31. package/js/src/lykke.js +10 -2
  32. package/js/src/ndax.d.ts +1 -1
  33. package/js/src/ndax.js +5 -1
  34. package/js/src/phemex.js +6 -5
  35. package/js/src/poloniexfutures.js +2 -2
  36. package/js/src/pro/bitget.js +28 -21
  37. package/js/src/pro/bitmex.js +9 -0
  38. package/js/src/pro/bybit.js +1 -1
  39. package/js/src/pro/mexc.js +1 -1
  40. package/js/src/pro/woo.js +1 -1
  41. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  42. package/js/src/tradeogre.d.ts +1 -1
  43. package/js/src/tradeogre.js +12 -6
  44. package/js/src/wavesexchange.d.ts +1 -20
  45. package/js/src/wavesexchange.js +2 -2
  46. package/js/src/wazirx.d.ts +1 -1
  47. package/js/src/wazirx.js +38 -15
  48. package/js/src/xt.d.ts +161 -0
  49. package/js/src/xt.js +4761 -0
  50. package/js/src/zonda.d.ts +1 -1
  51. package/js/src/zonda.js +9 -1
  52. package/package.json +1 -1
@@ -1572,7 +1572,11 @@ class ndax extends ndax$1 {
1572
1572
  // "detail":null
1573
1573
  // }
1574
1574
  //
1575
- return response;
1575
+ return [
1576
+ this.safeOrder({
1577
+ 'info': response,
1578
+ }),
1579
+ ];
1576
1580
  }
1577
1581
  async cancelOrder(id, symbol = undefined, params = {}) {
1578
1582
  /**
@@ -2954,6 +2954,7 @@ class phemex extends phemex$1 {
2954
2954
  /**
2955
2955
  * @method
2956
2956
  * @name phemex#fetchOrder
2957
+ * @see https://phemex-docs.github.io/#query-orders-by-ids
2957
2958
  * @description fetches information on an order made by the user
2958
2959
  * @param {string} symbol unified symbol of the market the order was made in
2959
2960
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2964,9 +2965,6 @@ class phemex extends phemex$1 {
2964
2965
  }
2965
2966
  await this.loadMarkets();
2966
2967
  const market = this.market(symbol);
2967
- if (market['settle'] === 'USDT') {
2968
- throw new errors.NotSupported(this.id + 'fetchOrder() is not supported yet for USDT settled swap markets'); // https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-order-by-orderid-or-query-user-order-by-client-order-id
2969
- }
2970
2968
  const request = {
2971
2969
  'symbol': market['id'],
2972
2970
  };
@@ -2979,7 +2977,10 @@ class phemex extends phemex$1 {
2979
2977
  request['orderID'] = id;
2980
2978
  }
2981
2979
  let response = undefined;
2982
- if (market['spot']) {
2980
+ if (market['settle'] === 'USDT') {
2981
+ response = await this.privateGetApiDataGFuturesOrdersByOrderId(this.extend(request, params));
2982
+ }
2983
+ else if (market['spot']) {
2983
2984
  response = await this.privateGetSpotOrdersActive(this.extend(request, params));
2984
2985
  }
2985
2986
  else {
@@ -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
  }
@@ -1225,23 +1225,30 @@ class bitget extends bitget$1 {
1225
1225
  // isolated and cross margin
1226
1226
  //
1227
1227
  // {
1228
- // "enterPointSource": "web",
1229
- // "force": "gtc",
1230
- // "feeDetail": [],
1231
- // "orderType": "limit",
1232
- // "price": "35000.000000000",
1233
- // "quoteSize": "10.500000000",
1234
- // "side": "buy",
1235
- // "status": "live",
1236
- // "baseSize": "0.000300000",
1237
- // "cTime": "1701923982427",
1238
- // "clientOid": "4902047879864dc980c4840e9906db4e",
1239
- // "fillPrice": "0.000000000",
1240
- // "baseVolume": "0.000000000",
1241
- // "fillTotalAmount": "0.000000000",
1242
- // "loanType": "auto-loan-and-repay",
1243
- // "orderId": "1116515595178356737"
1244
- // }
1228
+ // enterPointSource: "web",
1229
+ // feeDetail: [
1230
+ // {
1231
+ // feeCoin: "AAVE",
1232
+ // deduction: "no",
1233
+ // totalDeductionFee: "0",
1234
+ // totalFee: "-0.00010740",
1235
+ // },
1236
+ // ],
1237
+ // force: "gtc",
1238
+ // orderType: "limit",
1239
+ // price: "93.170000000",
1240
+ // fillPrice: "93.170000000",
1241
+ // baseSize: "0.110600000", // total amount of order
1242
+ // quoteSize: "10.304602000", // total cost of order (independently if order is filled or pending)
1243
+ // baseVolume: "0.107400000", // filled amount of order (during order's lifecycle, and not for this specific incoming update)
1244
+ // fillTotalAmount: "10.006458000", // filled cost of order (during order's lifecycle, and not for this specific incoming update)
1245
+ // side: "buy",
1246
+ // status: "partially_filled",
1247
+ // cTime: "1717875017306",
1248
+ // clientOid: "b57afe789a06454e9c560a2aab7f7201",
1249
+ // loanType: "auto-loan",
1250
+ // orderId: "1183419084588060673",
1251
+ // }
1245
1252
  //
1246
1253
  const isSpot = !('posMode' in order);
1247
1254
  const isMargin = ('loanType' in order);
@@ -1282,12 +1289,12 @@ class bitget extends bitget$1 {
1282
1289
  let filledAmount = undefined;
1283
1290
  let cost = undefined;
1284
1291
  let remaining = undefined;
1285
- const totalFilled = this.safeString(order, 'accBaseVolume');
1292
+ let totalFilled = this.safeString(order, 'accBaseVolume');
1286
1293
  if (isSpot) {
1287
1294
  if (isMargin) {
1288
- filledAmount = this.omitZero(this.safeString(order, 'fillTotalAmount'));
1289
- totalAmount = this.omitZero(this.safeString(order, 'baseSize')); // for margin trading
1290
- cost = this.safeString(order, 'quoteSize');
1295
+ totalAmount = this.safeString(order, 'baseSize');
1296
+ totalFilled = this.safeString(order, 'baseVolume');
1297
+ cost = this.safeString(order, 'fillTotalAmount');
1291
1298
  }
1292
1299
  else {
1293
1300
  const partialFillAmount = this.safeString(order, 'baseVolume');
@@ -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
  }
@@ -123,7 +123,7 @@ class bybit extends bybit$1 {
123
123
  },
124
124
  'streaming': {
125
125
  'ping': this.ping,
126
- 'keepAlive': 19000,
126
+ 'keepAlive': 18000,
127
127
  },
128
128
  });
129
129
  }
@@ -61,7 +61,7 @@ class mexc extends mexc$1 {
61
61
  },
62
62
  'streaming': {
63
63
  'ping': this.ping,
64
- 'keepAlive': 10000,
64
+ 'keepAlive': 8000,
65
65
  },
66
66
  'exceptions': {},
67
67
  });
@@ -53,7 +53,7 @@ class woo extends woo$1 {
53
53
  },
54
54
  'streaming': {
55
55
  'ping': this.ping,
56
- 'keepAlive': 10000,
56
+ 'keepAlive': 9000,
57
57
  },
58
58
  'exceptions': {
59
59
  'ws': {
@@ -449,7 +449,7 @@ class tradeogre extends tradeogre$1 {
449
449
  * @name tradeogre#createOrder
450
450
  * @description create a trade order
451
451
  * @param {string} symbol unified symbol of the market to create an order in
452
- * @param {string} type not used by tradeogre
452
+ * @param {string} type must be 'limit'
453
453
  * @param {string} side 'buy' or 'sell'
454
454
  * @param {float} amount how much of currency you want to trade in units of base currency
455
455
  * @param {float} price the price at which the order is to be fullfilled, in units of the quote currency
@@ -458,14 +458,17 @@ class tradeogre extends tradeogre$1 {
458
458
  */
459
459
  await this.loadMarkets();
460
460
  const market = this.market(symbol);
461
+ if (type === 'market') {
462
+ throw new errors.BadRequest(this.id + ' createOrder does not support market orders');
463
+ }
464
+ if (price === undefined) {
465
+ throw new errors.ArgumentsRequired(this.id + ' createOrder requires a limit parameter');
466
+ }
461
467
  const request = {
462
468
  'market': market['id'],
463
469
  'quantity': this.parseToNumeric(this.amountToPrecision(symbol, amount)),
464
470
  'price': this.parseToNumeric(this.priceToPrecision(symbol, price)),
465
471
  };
466
- if (type === 'market') {
467
- throw new errors.BadRequest(this.id + ' createOrder does not support market orders');
468
- }
469
472
  let response = undefined;
470
473
  if (side === 'buy') {
471
474
  response = await this.privatePostOrderBuy(this.extend(request, params));
@@ -502,7 +505,10 @@ class tradeogre extends tradeogre$1 {
502
505
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
503
506
  */
504
507
  await this.loadMarkets();
505
- return await this.cancelOrder('all', symbol, params);
508
+ const response = await this.cancelOrder('all', symbol, params);
509
+ return [
510
+ response,
511
+ ];
506
512
  }
507
513
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
508
514
  /**
@@ -1499,7 +1499,7 @@ class wavesexchange extends wavesexchange$1 {
1499
1499
  const firstMessage = this.safeValue(message, 0);
1500
1500
  const firstOrder = this.safeValue(firstMessage, 0);
1501
1501
  const returnedId = this.safeString(firstOrder, 'orderId');
1502
- return {
1502
+ return this.safeOrder({
1503
1503
  'info': response,
1504
1504
  'id': returnedId,
1505
1505
  'clientOrderId': undefined,
@@ -1518,7 +1518,7 @@ class wavesexchange extends wavesexchange$1 {
1518
1518
  'status': undefined,
1519
1519
  'fee': undefined,
1520
1520
  'trades': undefined,
1521
- };
1521
+ });
1522
1522
  }
1523
1523
  async fetchOrder(id, symbol = undefined, params = {}) {
1524
1524
  /**
@@ -792,7 +792,26 @@ class wazirx extends wazirx$1 {
792
792
  const request = {
793
793
  'symbol': market['id'],
794
794
  };
795
- return await this.privateDeleteOpenOrders(this.extend(request, params));
795
+ const response = await this.privateDeleteOpenOrders(this.extend(request, params));
796
+ //
797
+ // [
798
+ // {
799
+ // id: "4565421197",
800
+ // symbol: "adausdt",
801
+ // type: "limit",
802
+ // side: "buy",
803
+ // status: "wait",
804
+ // price: "0.41",
805
+ // origQty: "11.00",
806
+ // executedQty: "0.00",
807
+ // avgPrice: "0.00",
808
+ // createdTime: "1718089507000",
809
+ // updatedTime: "1718089507000",
810
+ // clientOrderId: "93d2a838-e272-405d-91e7-3a7bc6d3a003"
811
+ // }
812
+ // ]
813
+ //
814
+ return this.parseOrders(response);
796
815
  }
797
816
  async cancelOrder(id, symbol = undefined, params = {}) {
798
817
  /**
@@ -868,18 +887,22 @@ class wazirx extends wazirx$1 {
868
887
  return this.parseOrder(response, market);
869
888
  }
870
889
  parseOrder(order, market = undefined) {
871
- // {
872
- // "id":1949417813,
873
- // "symbol":"ltcusdt",
874
- // "type":"limit",
875
- // "side":"sell",
876
- // "status":"done",
877
- // "price":"146.2",
878
- // "origQty":"0.05",
879
- // "executedQty":"0.05",
880
- // "createdTime":1641252564000,
881
- // "updatedTime":1641252564000
882
- // },
890
+ //
891
+ // {
892
+ // "id": 1949417813,
893
+ // "symbol": "ltcusdt",
894
+ // "type": "limit",
895
+ // "side": "sell",
896
+ // "status": "done",
897
+ // "price": "146.2",
898
+ // "origQty": "0.05",
899
+ // "executedQty": "0.05",
900
+ // "avgPrice": "0.00",
901
+ // "createdTime": 1641252564000,
902
+ // "updatedTime": 1641252564000
903
+ // "clientOrderId": "93d2a838-e272-405d-91e7-3a7bc6d3a003"
904
+ // }
905
+ //
883
906
  const created = this.safeInteger(order, 'createdTime');
884
907
  const updated = this.safeInteger(order, 'updatedTime');
885
908
  const marketId = this.safeString(order, 'symbol');
@@ -894,7 +917,7 @@ class wazirx extends wazirx$1 {
894
917
  return this.safeOrder({
895
918
  'info': order,
896
919
  'id': id,
897
- 'clientOrderId': undefined,
920
+ 'clientOrderId': this.safeString(order, 'clientOrderId'),
898
921
  'timestamp': created,
899
922
  'datetime': this.iso8601(created),
900
923
  'lastTradeTimestamp': updated,
@@ -910,7 +933,7 @@ class wazirx extends wazirx$1 {
910
933
  'remaining': undefined,
911
934
  'cost': undefined,
912
935
  'fee': undefined,
913
- 'average': undefined,
936
+ 'average': this.safeString(order, 'avgPrice'),
914
937
  'trades': [],
915
938
  }, market);
916
939
  }