ccxt 4.4.28 → 4.4.30

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 (62) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +59 -7
  5. package/dist/cjs/src/base/Exchange.js +3 -0
  6. package/dist/cjs/src/binance.js +9 -0
  7. package/dist/cjs/src/bitbns.js +12 -12
  8. package/dist/cjs/src/bitfinex.js +9 -9
  9. package/dist/cjs/src/bitget.js +99 -6
  10. package/dist/cjs/src/bitmart.js +53 -53
  11. package/dist/cjs/src/bitopro.js +21 -21
  12. package/dist/cjs/src/bitrue.js +28 -28
  13. package/dist/cjs/src/bitvavo.js +4 -0
  14. package/dist/cjs/src/bybit.js +51 -646
  15. package/dist/cjs/src/coincatch.js +24 -4
  16. package/dist/cjs/src/deribit.js +7 -3
  17. package/dist/cjs/src/hyperliquid.js +108 -4
  18. package/dist/cjs/src/lbank.js +7 -1
  19. package/dist/cjs/src/pro/bitvavo.js +2 -1
  20. package/dist/cjs/src/pro/blofin.js +2 -1
  21. package/dist/cjs/src/pro/mexc.js +198 -30
  22. package/dist/cjs/src/vertex.js +51 -6
  23. package/examples/README.md +0 -2
  24. package/examples/js/cli.js +7 -0
  25. package/js/ccxt.d.ts +1 -1
  26. package/js/ccxt.js +1 -1
  27. package/js/src/abstract/alpaca.d.ts +1 -0
  28. package/js/src/abstract/binance.d.ts +9 -0
  29. package/js/src/abstract/binancecoinm.d.ts +9 -0
  30. package/js/src/abstract/binanceus.d.ts +9 -0
  31. package/js/src/abstract/binanceusdm.d.ts +9 -0
  32. package/js/src/abstract/bybit.d.ts +0 -13
  33. package/js/src/alpaca.d.ts +2 -0
  34. package/js/src/alpaca.js +59 -7
  35. package/js/src/base/Exchange.d.ts +1 -0
  36. package/js/src/base/Exchange.js +3 -0
  37. package/js/src/binance.js +9 -0
  38. package/js/src/bitbns.js +12 -12
  39. package/js/src/bitfinex.js +9 -9
  40. package/js/src/bitfinex2.d.ts +1 -1
  41. package/js/src/bitget.d.ts +2 -1
  42. package/js/src/bitget.js +99 -6
  43. package/js/src/bitmart.d.ts +1 -1
  44. package/js/src/bitmart.js +53 -53
  45. package/js/src/bitopro.js +21 -21
  46. package/js/src/bitrue.js +28 -28
  47. package/js/src/bitvavo.js +4 -0
  48. package/js/src/bybit.d.ts +0 -8
  49. package/js/src/bybit.js +51 -646
  50. package/js/src/coincatch.d.ts +1 -1
  51. package/js/src/coincatch.js +24 -4
  52. package/js/src/deribit.js +7 -3
  53. package/js/src/hyperliquid.d.ts +3 -1
  54. package/js/src/hyperliquid.js +108 -4
  55. package/js/src/lbank.js +7 -1
  56. package/js/src/pro/bitvavo.js +2 -1
  57. package/js/src/pro/blofin.js +2 -1
  58. package/js/src/pro/mexc.js +198 -30
  59. package/js/src/vertex.d.ts +4 -2
  60. package/js/src/vertex.js +51 -6
  61. package/js/src/whitebit.d.ts +1 -1
  62. package/package.json +1 -1
@@ -619,7 +619,7 @@ class bitrue extends bitrue$1 {
619
619
  // }
620
620
  //
621
621
  const result = {};
622
- const coins = this.safeValue(response, 'coins', []);
622
+ const coins = this.safeList(response, 'coins', []);
623
623
  for (let i = 0; i < coins.length; i++) {
624
624
  const currency = coins[i];
625
625
  const id = this.safeString(currency, 'coin');
@@ -630,15 +630,15 @@ class bitrue extends bitrue$1 {
630
630
  let minWithdrawString = undefined;
631
631
  let maxWithdrawString = undefined;
632
632
  let minWithdrawFeeString = undefined;
633
- const networkDetails = this.safeValue(currency, 'chainDetail', []);
633
+ const networkDetails = this.safeList(currency, 'chainDetail', []);
634
634
  const networks = {};
635
635
  for (let j = 0; j < networkDetails.length; j++) {
636
636
  const entry = networkDetails[j];
637
637
  const networkId = this.safeString(entry, 'chain');
638
638
  const network = this.networkIdToCode(networkId, code);
639
- const enableDeposit = this.safeValue(entry, 'enableDeposit');
639
+ const enableDeposit = this.safeBool(entry, 'enableDeposit');
640
640
  deposit = (enableDeposit) ? enableDeposit : deposit;
641
- const enableWithdraw = this.safeValue(entry, 'enableWithdraw');
641
+ const enableWithdraw = this.safeBool(entry, 'enableWithdraw');
642
642
  withdraw = (enableWithdraw) ? enableWithdraw : withdraw;
643
643
  const networkWithdrawFeeString = this.safeString(entry, 'withdrawFee');
644
644
  if (networkWithdrawFeeString !== undefined) {
@@ -833,11 +833,11 @@ class bitrue extends bitrue$1 {
833
833
  if (settle !== undefined) {
834
834
  symbol += ':' + settle;
835
835
  }
836
- const filters = this.safeValue(market, 'filters', []);
836
+ const filters = this.safeList(market, 'filters', []);
837
837
  const filtersByType = this.indexBy(filters, 'filterType');
838
838
  const status = this.safeString(market, 'status');
839
- const priceFilter = this.safeValue(filtersByType, 'PRICE_FILTER', {});
840
- const amountFilter = this.safeValue(filtersByType, 'LOT_SIZE', {});
839
+ const priceFilter = this.safeDict(filtersByType, 'PRICE_FILTER', {});
840
+ const amountFilter = this.safeDict(filtersByType, 'LOT_SIZE', {});
841
841
  const defaultPricePrecision = this.safeString(market, 'pricePrecision');
842
842
  const defaultAmountPrecision = this.safeString(market, 'quantityPrecision');
843
843
  const pricePrecision = this.safeString(priceFilter, 'priceScale', defaultPricePrecision);
@@ -990,7 +990,7 @@ class bitrue extends bitrue$1 {
990
990
  if (type === 'swap') {
991
991
  if (subType !== undefined && subType === 'inverse') {
992
992
  response = await this.dapiV2PrivateGetAccount(params);
993
- result = this.safeValue(response, 'data', {});
993
+ result = this.safeDict(response, 'data', {});
994
994
  //
995
995
  // {
996
996
  // "code":"0",
@@ -1024,7 +1024,7 @@ class bitrue extends bitrue$1 {
1024
1024
  }
1025
1025
  else {
1026
1026
  response = await this.fapiV2PrivateGetAccount(params);
1027
- result = this.safeValue(response, 'data', {});
1027
+ result = this.safeDict(response, 'data', {});
1028
1028
  //
1029
1029
  // {
1030
1030
  // "code":"0",
@@ -1260,7 +1260,7 @@ class bitrue extends bitrue$1 {
1260
1260
  'symbol': market['id'],
1261
1261
  };
1262
1262
  response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1263
- data = this.safeValue(response, 0, {});
1263
+ data = this.safeDict(response, 0, {});
1264
1264
  }
1265
1265
  else {
1266
1266
  throw new errors.NotSupported(this.id + ' fetchTicker only support spot & swap markets');
@@ -1322,11 +1322,11 @@ class bitrue extends bitrue$1 {
1322
1322
  */
1323
1323
  await this.loadMarkets();
1324
1324
  const market = this.market(symbol);
1325
- const timeframes = this.safeValue(this.options, 'timeframes', {});
1325
+ const timeframes = this.safeDict(this.options, 'timeframes', {});
1326
1326
  let response = undefined;
1327
1327
  let data = undefined;
1328
1328
  if (market['swap']) {
1329
- const timeframesFuture = this.safeValue(timeframes, 'future', {});
1329
+ const timeframesFuture = this.safeDict(timeframes, 'future', {});
1330
1330
  const request = {
1331
1331
  'contractName': market['id'],
1332
1332
  // 1min / 5min / 15min / 30min / 1h / 1day / 1week / 1month
@@ -1344,7 +1344,7 @@ class bitrue extends bitrue$1 {
1344
1344
  data = response;
1345
1345
  }
1346
1346
  else if (market['spot']) {
1347
- const timeframesSpot = this.safeValue(timeframes, 'spot', {});
1347
+ const timeframesSpot = this.safeDict(timeframes, 'spot', {});
1348
1348
  const request = {
1349
1349
  'symbol': market['id'],
1350
1350
  // 1m / 5m / 15m / 30m / 1H / 2H / 4H / 12H / 1D / 1W
@@ -1357,7 +1357,7 @@ class bitrue extends bitrue$1 {
1357
1357
  request['fromIdx'] = since;
1358
1358
  }
1359
1359
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
1360
- data = this.safeValue(response, 'data', []);
1360
+ data = this.safeList(response, 'data', []);
1361
1361
  }
1362
1362
  else {
1363
1363
  throw new errors.NotSupported(this.id + ' fetchOHLCV only support spot & swap markets');
@@ -1582,7 +1582,7 @@ class bitrue extends bitrue$1 {
1582
1582
  // https://github.com/ccxt/ccxt/issues/13856
1583
1583
  const tickers = {};
1584
1584
  for (let i = 0; i < data.length; i++) {
1585
- const ticker = this.safeValue(data, i, {});
1585
+ const ticker = this.safeDict(data, i, {});
1586
1586
  const market = this.market(this.safeValue(ticker, 'symbol'));
1587
1587
  tickers[market['id']] = ticker;
1588
1588
  }
@@ -1645,8 +1645,8 @@ class bitrue extends bitrue$1 {
1645
1645
  const orderId = this.safeString(trade, 'orderId');
1646
1646
  const id = this.safeString2(trade, 'id', 'tradeId');
1647
1647
  let side = undefined;
1648
- const buyerMaker = this.safeValue(trade, 'isBuyerMaker'); // ignore "m" until Bitrue fixes api
1649
- const isBuyer = this.safeValue(trade, 'isBuyer');
1648
+ const buyerMaker = this.safeBool(trade, 'isBuyerMaker'); // ignore "m" until Bitrue fixes api
1649
+ const isBuyer = this.safeBool(trade, 'isBuyer');
1650
1650
  if (buyerMaker !== undefined) {
1651
1651
  side = buyerMaker ? 'sell' : 'buy';
1652
1652
  }
@@ -1661,7 +1661,7 @@ class bitrue extends bitrue$1 {
1661
1661
  };
1662
1662
  }
1663
1663
  let takerOrMaker = undefined;
1664
- const isMaker = this.safeValue(trade, 'isMaker');
1664
+ const isMaker = this.safeBool(trade, 'isMaker');
1665
1665
  if (isMaker !== undefined) {
1666
1666
  takerOrMaker = isMaker ? 'maker' : 'taker';
1667
1667
  }
@@ -1826,7 +1826,7 @@ class bitrue extends bitrue$1 {
1826
1826
  const id = this.safeString(order, 'orderId');
1827
1827
  let type = this.safeStringLower(order, 'type');
1828
1828
  const side = this.safeStringLower(order, 'side');
1829
- const fills = this.safeValue(order, 'fills', []);
1829
+ const fills = this.safeList(order, 'fills', []);
1830
1830
  const clientOrderId = this.safeString(order, 'clientOrderId');
1831
1831
  const timeInForce = this.safeString(order, 'timeInForce');
1832
1832
  const postOnly = (type === 'limit_maker') || (timeInForce === 'GTX') || (type === 'post_only');
@@ -1973,7 +1973,7 @@ class bitrue extends bitrue$1 {
1973
1973
  else if (market['inverse']) {
1974
1974
  response = await this.dapiV2PrivatePostOrder(this.extend(request, params));
1975
1975
  }
1976
- data = this.safeValue(response, 'data', {});
1976
+ data = this.safeDict(response, 'data', {});
1977
1977
  }
1978
1978
  else if (market['spot']) {
1979
1979
  request['symbol'] = market['id'];
@@ -2063,7 +2063,7 @@ class bitrue extends bitrue$1 {
2063
2063
  else if (market['inverse']) {
2064
2064
  response = await this.dapiV2PrivateGetOrder(this.extend(request, params));
2065
2065
  }
2066
- data = this.safeValue(response, 'data', {});
2066
+ data = this.safeDict(response, 'data', {});
2067
2067
  }
2068
2068
  else if (market['spot']) {
2069
2069
  request['orderId'] = id; // spot market id is mandatory
@@ -2207,7 +2207,7 @@ class bitrue extends bitrue$1 {
2207
2207
  else if (market['inverse']) {
2208
2208
  response = await this.dapiV2PrivateGetOpenOrders(this.extend(request, params));
2209
2209
  }
2210
- data = this.safeValue(response, 'data', []);
2210
+ data = this.safeList(response, 'data', []);
2211
2211
  }
2212
2212
  else if (market['spot']) {
2213
2213
  request['symbol'] = market['id'];
@@ -2307,7 +2307,7 @@ class bitrue extends bitrue$1 {
2307
2307
  else if (market['inverse']) {
2308
2308
  response = await this.dapiV2PrivatePostCancel(this.extend(request, params));
2309
2309
  }
2310
- data = this.safeValue(response, 'data', {});
2310
+ data = this.safeDict(response, 'data', {});
2311
2311
  }
2312
2312
  else if (market['spot']) {
2313
2313
  request['symbol'] = market['id'];
@@ -2365,7 +2365,7 @@ class bitrue extends bitrue$1 {
2365
2365
  else if (market['inverse']) {
2366
2366
  response = await this.dapiV2PrivatePostAllOpenOrders(this.extend(request, params));
2367
2367
  }
2368
- data = this.safeValue(response, 'data', []);
2368
+ data = this.safeList(response, 'data', []);
2369
2369
  }
2370
2370
  else {
2371
2371
  throw new errors.NotSupported(this.id + ' cancelAllOrders only support future markets');
@@ -2420,7 +2420,7 @@ class bitrue extends bitrue$1 {
2420
2420
  else if (market['inverse']) {
2421
2421
  response = await this.dapiV2PrivateGetMyTrades(this.extend(request, params));
2422
2422
  }
2423
- data = this.safeValue(response, 'data', []);
2423
+ data = this.safeList(response, 'data', []);
2424
2424
  }
2425
2425
  else if (market['spot']) {
2426
2426
  request['symbol'] = market['id'];
@@ -2620,7 +2620,7 @@ class bitrue extends bitrue$1 {
2620
2620
  '6': 'canceled',
2621
2621
  },
2622
2622
  };
2623
- const statuses = this.safeValue(statusesByType, type, {});
2623
+ const statuses = this.safeDict(statusesByType, type, {});
2624
2624
  return this.safeString(statuses, status, status);
2625
2625
  }
2626
2626
  parseTransaction(transaction, currency = undefined) {
@@ -2811,7 +2811,7 @@ class bitrue extends bitrue$1 {
2811
2811
  // "chainDetail": [ [Object] ]
2812
2812
  // }
2813
2813
  //
2814
- const chainDetails = this.safeValue(fee, 'chainDetail', []);
2814
+ const chainDetails = this.safeList(fee, 'chainDetail', []);
2815
2815
  const chainDetailLength = chainDetails.length;
2816
2816
  const result = {
2817
2817
  'info': fee,
@@ -2967,7 +2967,7 @@ class bitrue extends bitrue$1 {
2967
2967
  */
2968
2968
  await this.loadMarkets();
2969
2969
  const currency = this.currency(code);
2970
- const accountTypes = this.safeValue(this.options, 'accountsByType', {});
2970
+ const accountTypes = this.safeDict(this.options, 'accountsByType', {});
2971
2971
  const fromId = this.safeString(accountTypes, fromAccount, fromAccount);
2972
2972
  const toId = this.safeString(accountTypes, toAccount, toAccount);
2973
2973
  const request = {
@@ -1114,6 +1114,10 @@ class bitvavo extends bitvavo$1 {
1114
1114
  if (postOnly) {
1115
1115
  request['postOnly'] = true;
1116
1116
  }
1117
+ const clientOrderId = this.safeString(params, 'clientOrderId');
1118
+ if (clientOrderId === undefined) {
1119
+ request['clientOrderId'] = this.uuid22();
1120
+ }
1117
1121
  return this.extend(request, params);
1118
1122
  }
1119
1123
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {