ccxt 4.1.10 → 4.1.12

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/CONTRIBUTING.md +2 -0
  2. package/README.md +3 -3
  3. package/build.sh +3 -1
  4. package/dist/ccxt.browser.js +324 -129
  5. package/dist/ccxt.browser.min.js +3 -3
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/Exchange.js +30 -2
  8. package/dist/cjs/src/binance.js +100 -46
  9. package/dist/cjs/src/bingx.js +15 -9
  10. package/dist/cjs/src/bitget.js +11 -4
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/bybit.js +14 -8
  13. package/dist/cjs/src/coinex.js +3 -3
  14. package/dist/cjs/src/coinspot.js +103 -8
  15. package/dist/cjs/src/cryptocom.js +1 -1
  16. package/dist/cjs/src/delta.js +4 -4
  17. package/dist/cjs/src/deribit.js +1 -1
  18. package/dist/cjs/src/huobi.js +8 -10
  19. package/dist/cjs/src/okx.js +4 -3
  20. package/dist/cjs/src/poloniex.js +1 -0
  21. package/dist/cjs/src/pro/binance.js +3 -9
  22. package/dist/cjs/src/pro/phemex.js +2 -2
  23. package/dist/cjs/src/whitebit.js +15 -11
  24. package/js/ccxt.d.ts +1 -1
  25. package/js/ccxt.js +1 -1
  26. package/js/src/abstract/binance.d.ts +3 -0
  27. package/js/src/abstract/binancecoinm.d.ts +3 -0
  28. package/js/src/abstract/binanceus.d.ts +3 -0
  29. package/js/src/abstract/binanceusdm.d.ts +3 -0
  30. package/js/src/abstract/bingx.d.ts +1 -0
  31. package/js/src/base/Exchange.d.ts +7 -6
  32. package/js/src/base/Exchange.js +30 -2
  33. package/js/src/base/types.d.ts +10 -0
  34. package/js/src/binance.d.ts +5 -13
  35. package/js/src/binance.js +100 -46
  36. package/js/src/bingx.d.ts +2 -16
  37. package/js/src/bingx.js +15 -9
  38. package/js/src/bitget.d.ts +2 -16
  39. package/js/src/bitget.js +11 -4
  40. package/js/src/bitmart.d.ts +2 -16
  41. package/js/src/bitmart.js +2 -2
  42. package/js/src/bybit.d.ts +8 -22
  43. package/js/src/bybit.js +14 -8
  44. package/js/src/coinex.js +3 -3
  45. package/js/src/coinspot.d.ts +1 -0
  46. package/js/src/coinspot.js +103 -8
  47. package/js/src/cryptocom.d.ts +1 -1
  48. package/js/src/cryptocom.js +1 -1
  49. package/js/src/delta.d.ts +4 -74
  50. package/js/src/delta.js +4 -4
  51. package/js/src/deribit.js +1 -1
  52. package/js/src/gate.d.ts +2 -2
  53. package/js/src/huobi.d.ts +4 -13
  54. package/js/src/huobi.js +8 -10
  55. package/js/src/mexc.d.ts +4 -4
  56. package/js/src/okx.d.ts +3 -21
  57. package/js/src/okx.js +4 -3
  58. package/js/src/poloniex.js +1 -0
  59. package/js/src/pro/binance.js +3 -9
  60. package/js/src/pro/phemex.js +2 -2
  61. package/js/src/whitebit.js +15 -11
  62. package/package.json +2 -2
@@ -8851,7 +8851,7 @@ class Exchange {
8851
8851
  }
8852
8852
  return result;
8853
8853
  }
8854
- marketSymbols(symbols, type = undefined, allowEmpty = true) {
8854
+ marketSymbols(symbols, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
8855
8855
  if (symbols === undefined) {
8856
8856
  if (!allowEmpty) {
8857
8857
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
@@ -8866,10 +8866,26 @@ class Exchange {
8866
8866
  return symbols;
8867
8867
  }
8868
8868
  const result = [];
8869
+ let marketType = undefined;
8870
+ let isLinearSubType = undefined;
8869
8871
  for (let i = 0; i < symbols.length; i++) {
8870
8872
  const market = this.market(symbols[i]);
8873
+ if (sameTypeOnly && (marketType !== undefined)) {
8874
+ if (market['type'] !== marketType) {
8875
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' symbols must be of the same type, either ' + marketType + ' or ' + market['type'] + '.');
8876
+ }
8877
+ }
8878
+ if (sameSubTypeOnly && (isLinearSubType !== undefined)) {
8879
+ if (market['linear'] !== isLinearSubType) {
8880
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' symbols must be of the same subType, either linear or inverse.');
8881
+ }
8882
+ }
8871
8883
  if (type !== undefined && market['type'] !== type) {
8872
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' symbols must be of same type ' + type + '. If the type is incorrect you can change it in options or the params of the request');
8884
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' symbols must be of the same type ' + type + '. If the type is incorrect you can change it in options or the params of the request');
8885
+ }
8886
+ marketType = market['type'];
8887
+ if (!market['spot']) {
8888
+ isLinearSubType = market['linear'];
8873
8889
  }
8874
8890
  const symbol = this.safeString(market, 'symbol', symbols[i]);
8875
8891
  result.push(symbol);
@@ -10898,6 +10914,18 @@ class Exchange {
10898
10914
  }
10899
10915
  return [request, params];
10900
10916
  }
10917
+ safeOpenInterest(interest, market = undefined) {
10918
+ return this.extend(interest, {
10919
+ 'symbol': this.safeString(market, 'symbol'),
10920
+ 'baseVolume': this.safeNumber(interest, 'baseVolume'),
10921
+ 'quoteVolume': this.safeNumber(interest, 'quoteVolume'),
10922
+ 'openInterestAmount': this.safeNumber(interest, 'openInterestAmount'),
10923
+ 'openInterestValue': this.safeNumber(interest, 'openInterestValue'),
10924
+ 'timestamp': this.safeInteger(interest, 'timestamp'),
10925
+ 'datetime': this.safeString(interest, 'datetime'),
10926
+ 'info': this.safeValue(interest, 'info'),
10927
+ });
10928
+ }
10901
10929
  }
10902
10930
 
10903
10931
 
@@ -15976,7 +16004,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15976
16004
  'rateLimit': 50,
15977
16005
  'certified': true,
15978
16006
  'pro': true,
15979
- // new metainfo interface
16007
+ // new metainfo2 interface
15980
16008
  'has': {
15981
16009
  'CORS': undefined,
15982
16010
  'spot': true,
@@ -16203,6 +16231,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16203
16231
  'loan/vip/loanable/data': 40,
16204
16232
  'loan/vip/collateral/data': 40,
16205
16233
  'loan/vip/request/data': 2.6668,
16234
+ 'loan/vip/request/interestRate': 2.6668,
16206
16235
  'loan/income': 40.002,
16207
16236
  'loan/ongoing/orders': 40,
16208
16237
  'loan/ltv/adjustment/history': 40,
@@ -16717,10 +16746,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16717
16746
  'adlQuantile': 5,
16718
16747
  'pmAccountInfo': 5,
16719
16748
  'orderAmendment': 1,
16720
- 'order/asyn': 5,
16721
- 'order/asyn/id': 5,
16722
- 'trade/asyn': 5,
16723
- 'trade/asyn/id': 5,
16749
+ 'income/asyn': 1000,
16750
+ 'income/asyn/id': 10,
16751
+ 'order/asyn': 1000,
16752
+ 'order/asyn/id': 10,
16753
+ 'trade/asyn': 1000,
16754
+ 'trade/asyn/id': 10,
16724
16755
  },
16725
16756
  'post': {
16726
16757
  'batchOrders': 5,
@@ -17758,14 +17789,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
17758
17789
  const query = this.omit(params, 'type');
17759
17790
  let subType = undefined;
17760
17791
  [subType, params] = this.handleSubTypeAndParams('fetchTime', undefined, params);
17761
- let method = 'publicGetTime';
17792
+ let response = undefined;
17762
17793
  if (this.isLinear(type, subType)) {
17763
- method = 'fapiPublicGetTime';
17794
+ response = await this.fapiPublicGetTime(query);
17764
17795
  }
17765
17796
  else if (this.isInverse(type, subType)) {
17766
- method = 'dapiPublicGetTime';
17797
+ response = await this.dapiPublicGetTime(query);
17798
+ }
17799
+ else {
17800
+ response = await this.publicGetTime(query);
17767
17801
  }
17768
- const response = await this[method](query);
17769
17802
  return this.safeInteger(response, 'serverTime');
17770
17803
  }
17771
17804
  async fetchCurrencies(params = {}) {
@@ -18339,6 +18372,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18339
18372
  },
18340
18373
  },
18341
18374
  'info': market,
18375
+ 'created': this.safeInteger(market, 'onboardDate'), // present in inverse & linear apis
18342
18376
  };
18343
18377
  if ('PRICE_FILTER' in filtersByType) {
18344
18378
  const filter = this.safeValue(filtersByType, 'PRICE_FILTER', {});
@@ -18666,7 +18700,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18666
18700
  // "unrealizedProfit":"0.00000000",
18667
18701
  // "positionInitialMargin":"0",
18668
18702
  // "openOrderInitialMargin":"0",
18669
- // "leverage":"20",
18703
+ // "leverage":"21",
18670
18704
  // "isolated":false,
18671
18705
  // "entryPrice":"0.00000",
18672
18706
  // "maxNotional":"5000000",
@@ -18750,17 +18784,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18750
18784
  if (limit !== undefined) {
18751
18785
  request['limit'] = limit; // default 100, max 5000, see https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#order-book
18752
18786
  }
18753
- let method = 'publicGetDepth';
18787
+ let response = undefined;
18754
18788
  if (market['option']) {
18755
- method = 'eapiPublicGetDepth';
18789
+ response = await this.eapiPublicGetDepth(this.extend(request, params));
18756
18790
  }
18757
18791
  else if (market['linear']) {
18758
- method = 'fapiPublicGetDepth';
18792
+ response = await this.fapiPublicGetDepth(this.extend(request, params));
18759
18793
  }
18760
18794
  else if (market['inverse']) {
18761
- method = 'dapiPublicGetDepth';
18795
+ response = await this.dapiPublicGetDepth(this.extend(request, params));
18796
+ }
18797
+ else {
18798
+ response = await this.publicGetDepth(this.extend(request, params));
18762
18799
  }
18763
- const response = await this[method](this.extend(request, params));
18764
18800
  //
18765
18801
  // future
18766
18802
  //
@@ -18994,17 +19030,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18994
19030
  const request = {
18995
19031
  'symbol': market['id'],
18996
19032
  };
18997
- let method = 'publicGetTicker24hr';
19033
+ let response = undefined;
18998
19034
  if (market['option']) {
18999
- method = 'eapiPublicGetTicker';
19035
+ response = await this.eapiPublicGetTicker(this.extend(request, params));
19000
19036
  }
19001
19037
  else if (market['linear']) {
19002
- method = 'fapiPublicGetTicker24hr';
19038
+ response = await this.fapiPublicGetTicker24hr(this.extend(request, params));
19003
19039
  }
19004
19040
  else if (market['inverse']) {
19005
- method = 'dapiPublicGetTicker24hr';
19041
+ response = await this.dapiPublicGetTicker24hr(this.extend(request, params));
19042
+ }
19043
+ else {
19044
+ response = await this.publicGetTicker24hr(this.extend(request, params));
19006
19045
  }
19007
- const response = await this[method](this.extend(request, params));
19008
19046
  if (Array.isArray(response)) {
19009
19047
  const firstTicker = this.safeValue(response, 0, {});
19010
19048
  return this.parseTicker(firstTicker, market);
@@ -19034,17 +19072,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19034
19072
  let subType = undefined;
19035
19073
  [subType, params] = this.handleSubTypeAndParams('fetchBidsAsks', market, params);
19036
19074
  [type, params] = this.handleMarketTypeAndParams('fetchBidsAsks', market, params);
19037
- let method = undefined;
19075
+ let response = undefined;
19038
19076
  if (this.isLinear(type, subType)) {
19039
- method = 'fapiPublicGetTickerBookTicker';
19077
+ response = await this.fapiPublicGetTickerBookTicker(params);
19040
19078
  }
19041
19079
  else if (this.isInverse(type, subType)) {
19042
- method = 'dapiPublicGetTickerBookTicker';
19080
+ response = await this.dapiPublicGetTickerBookTicker(params);
19043
19081
  }
19044
19082
  else {
19045
- method = 'publicGetTickerBookTicker';
19083
+ response = await this.publicGetTickerBookTicker(params);
19046
19084
  }
19047
- const response = await this[method](params);
19048
19085
  return this.parseTickers(response, symbols);
19049
19086
  }
19050
19087
  async fetchLastPrices(symbols = undefined, params = {}) {
@@ -19066,9 +19103,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19066
19103
  let subType = undefined;
19067
19104
  [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
19068
19105
  [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
19069
- let method = undefined;
19106
+ let response = undefined;
19070
19107
  if (this.isLinear(type, subType)) {
19071
- method = 'fapiPublicGetTickerPrice';
19108
+ response = await this.fapiPublicGetTickerPrice(params);
19072
19109
  //
19073
19110
  // [
19074
19111
  // {
@@ -19081,7 +19118,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19081
19118
  //
19082
19119
  }
19083
19120
  else if (this.isInverse(type, subType)) {
19084
- method = 'dapiPublicGetTickerPrice';
19121
+ response = await this.dapiPublicGetTickerPrice(params);
19085
19122
  //
19086
19123
  // [
19087
19124
  // {
@@ -19094,7 +19131,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19094
19131
  //
19095
19132
  }
19096
19133
  else if (type === 'spot') {
19097
- method = 'publicGetTickerPrice';
19134
+ response = await this.publicGetTickerPrice(params);
19098
19135
  //
19099
19136
  // [
19100
19137
  // {
@@ -19108,7 +19145,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19108
19145
  else {
19109
19146
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
19110
19147
  }
19111
- const response = await this[method](params);
19112
19148
  return this.parseLastPrices(response, symbols);
19113
19149
  }
19114
19150
  parseLastPrice(info, market = undefined) {
@@ -19168,6 +19204,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19168
19204
  await this.loadMarkets();
19169
19205
  let type = undefined;
19170
19206
  let market = undefined;
19207
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
19171
19208
  if (symbols !== undefined) {
19172
19209
  const first = this.safeString(symbols, 0);
19173
19210
  market = this.market(first);
@@ -22427,10 +22464,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22427
22464
  }
22428
22465
  parseTradingFee(fee, market = undefined) {
22429
22466
  //
22467
+ // spot
22468
+ // [
22469
+ // {
22470
+ // "symbol": "BTCUSDT",
22471
+ // "makerCommission": "0.001",
22472
+ // "takerCommission": "0.001"
22473
+ // }
22474
+ // ]
22475
+ //
22476
+ // swap
22430
22477
  // {
22431
- // "symbol": "ADABNB",
22432
- // "makerCommission": 0.001,
22433
- // "takerCommission": 0.001
22478
+ // "symbol": "BTCUSD_PERP",
22479
+ // "makerCommissionRate": "0.00015", // 0.015%
22480
+ // "takerCommissionRate": "0.00040" // 0.040%
22434
22481
  // }
22435
22482
  //
22436
22483
  const marketId = this.safeString(fee, 'symbol');
@@ -22438,8 +22485,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22438
22485
  return {
22439
22486
  'info': fee,
22440
22487
  'symbol': symbol,
22441
- 'maker': this.safeNumber(fee, 'makerCommission'),
22442
- 'taker': this.safeNumber(fee, 'takerCommission'),
22488
+ 'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
22489
+ 'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
22443
22490
  };
22444
22491
  }
22445
22492
  async fetchTradingFee(symbol, params = {}) {
@@ -22448,17 +22495,37 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22448
22495
  * @name binance#fetchTradingFee
22449
22496
  * @description fetch the trading fees for a market
22450
22497
  * @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
22498
+ * @see https://binance-docs.github.io/apidocs/futures/en/#user-commission-rate-user_data
22499
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#user-commission-rate-user_data
22451
22500
  * @param {string} symbol unified market symbol
22452
22501
  * @param {object} [params] extra parameters specific to the binance api endpoint
22453
22502
  * @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
22454
22503
  */
22455
22504
  await this.loadMarkets();
22456
22505
  const market = this.market(symbol);
22506
+ const defaultType = this.safeString2(this.options, 'fetchTradingFee', 'defaultType', 'linear');
22507
+ const type = this.safeString(params, 'type', defaultType);
22508
+ params = this.omit(params, 'type');
22509
+ let subType = undefined;
22510
+ [subType, params] = this.handleSubTypeAndParams('fetchTradingFee', market, params);
22511
+ const isSpotOrMargin = (type === 'spot') || (type === 'margin');
22512
+ const isLinear = this.isLinear(type, subType);
22513
+ const isInverse = this.isInverse(type, subType);
22457
22514
  const request = {
22458
22515
  'symbol': market['id'],
22459
22516
  };
22460
- const response = await this.sapiGetAssetTradeFee(this.extend(request, params));
22517
+ let response = undefined;
22518
+ if (isSpotOrMargin) {
22519
+ response = await this.sapiGetAssetTradeFee(this.extend(request, params));
22520
+ }
22521
+ else if (isLinear) {
22522
+ response = await this.fapiPrivateGetCommissionRate(this.extend(request, params));
22523
+ }
22524
+ else if (isInverse) {
22525
+ response = await this.dapiPrivateGetCommissionRate(this.extend(request, params));
22526
+ }
22461
22527
  //
22528
+ // spot
22462
22529
  // [
22463
22530
  // {
22464
22531
  // "symbol": "BTCUSDT",
@@ -22467,8 +22534,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22467
22534
  // }
22468
22535
  // ]
22469
22536
  //
22470
- const first = this.safeValue(response, 0, {});
22471
- return this.parseTradingFee(first);
22537
+ // swap
22538
+ // {
22539
+ // "symbol": "BTCUSD_PERP",
22540
+ // "makerCommissionRate": "0.00015", // 0.015%
22541
+ // "takerCommissionRate": "0.00040" // 0.040%
22542
+ // }
22543
+ //
22544
+ let data = response;
22545
+ if (Array.isArray(data)) {
22546
+ data = this.safeValue(data, 0, {});
22547
+ }
22548
+ return this.parseTradingFee(data);
22472
22549
  }
22473
22550
  async fetchTradingFees(params = {}) {
22474
22551
  /**
@@ -22483,11 +22560,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22483
22560
  */
22484
22561
  await this.loadMarkets();
22485
22562
  let method = undefined;
22486
- const defaultType = this.safeString2(this.options, 'fetchTradingFees', 'defaultType', 'linear');
22487
- const type = this.safeString(params, 'type', defaultType);
22488
- params = this.omit(params, 'type');
22563
+ let type = undefined;
22564
+ [type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
22489
22565
  let subType = undefined;
22490
- [subType, params] = this.handleSubTypeAndParams('fetchTradingFees', undefined, params);
22566
+ [subType, params] = this.handleSubTypeAndParams('fetchTradingFees', undefined, params, 'linear');
22491
22567
  const isSpotOrMargin = (type === 'spot') || (type === 'margin');
22492
22568
  const isLinear = this.isLinear(type, subType);
22493
22569
  const isInverse = this.isInverse(type, subType);
@@ -24340,7 +24416,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24340
24416
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError(this.id + ' userDataStream endpoint requires `apiKey` credential');
24341
24417
  }
24342
24418
  }
24343
- else if ((api === 'private') || (api === 'eapiPrivate') || (api === 'sapi' && path !== 'system/status') || (api === 'sapiV2') || (api === 'sapiV3') || (api === 'sapiV4') || (api === 'wapi' && path !== 'systemStatus') || (api === 'dapiPrivate') || (api === 'dapiPrivateV2') || (api === 'fapiPrivate') || (api === 'fapiPrivateV2')) {
24419
+ else if ((api === 'private') || (api === 'eapiPrivate') || (api === 'sapi' && path !== 'system/status') || (api === 'sapiV2') || (api === 'sapiV3') || (api === 'sapiV4') || (api === 'wapi' && path !== 'systemStatus') || (api === 'dapiPrivate') || (api === 'dapiPrivateV2') || (api === 'fapiPrivate') || (api === 'fapiPrivateV2') || (api === 'papi')) {
24344
24420
  this.checkRequiredCredentials();
24345
24421
  if (method === 'POST' && ((path === 'order') || (path === 'sor/order'))) {
24346
24422
  // inject in implicit API calls
@@ -25095,7 +25171,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25095
25171
  // ]
25096
25172
  //
25097
25173
  if (market['option']) {
25098
- return this.parseOpenInterests(response, market);
25174
+ const result = this.parseOpenInterests(response, market);
25175
+ for (let i = 0; i < result.length; i++) {
25176
+ const item = result[i];
25177
+ if (item['symbol'] === symbol) {
25178
+ return item;
25179
+ }
25180
+ }
25099
25181
  }
25100
25182
  else {
25101
25183
  return this.parseOpenInterest(response, market);
@@ -25108,7 +25190,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25108
25190
  const value = this.safeNumber2(interest, 'sumOpenInterestValue', 'sumOpenInterestUsd');
25109
25191
  // Inverse returns the number of contracts different from the base or quote volume in this case
25110
25192
  // compared with https://www.binance.com/en/futures/funding-history/quarterly/4
25111
- return {
25193
+ return this.safeOpenInterest({
25112
25194
  'symbol': this.safeSymbol(id, market, undefined, 'contract'),
25113
25195
  'baseVolume': market['inverse'] ? undefined : amount,
25114
25196
  'quoteVolume': value,
@@ -25117,7 +25199,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25117
25199
  'timestamp': timestamp,
25118
25200
  'datetime': this.iso8601(timestamp),
25119
25201
  'info': interest,
25120
- };
25202
+ }, market);
25121
25203
  }
25122
25204
  }
25123
25205
 
@@ -25483,6 +25565,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25483
25565
  },
25484
25566
  },
25485
25567
  },
25568
+ 'v3': {
25569
+ 'public': {
25570
+ 'get': {
25571
+ 'quote/klines': 1,
25572
+ },
25573
+ },
25574
+ },
25486
25575
  },
25487
25576
  'contract': {
25488
25577
  'v1': {
@@ -25940,12 +26029,12 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25940
26029
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
25941
26030
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
25942
26031
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
26032
+ * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
25943
26033
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
25944
26034
  * @param {string} timeframe the length of time each candle represents
25945
26035
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
25946
26036
  * @param {int} [limit] the maximum amount of candles to fetch
25947
26037
  * @param {object} [params] extra parameters specific to the bingx api endpoint
25948
- * @param {string} [params.price] "mark" or "index" for mark price and index price candles
25949
26038
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
25950
26039
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
25951
26040
  * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
@@ -25967,20 +26056,17 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25967
26056
  if (limit !== undefined) {
25968
26057
  request['limit'] = limit;
25969
26058
  }
25970
- else {
25971
- request['limit'] = 50;
25972
- }
25973
- const until = this.safeInteger2(params, 'until', 'startTime');
26059
+ const until = this.safeInteger2(params, 'until', 'endTime');
25974
26060
  if (until !== undefined) {
25975
26061
  params = this.omit(params, ['until']);
25976
- request['startTime'] = until;
26062
+ request['endTime'] = until;
25977
26063
  }
25978
26064
  let response = undefined;
25979
26065
  if (market['spot']) {
25980
26066
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
25981
26067
  }
25982
26068
  else {
25983
- response = await this.swapV2PublicGetQuoteKlines(this.extend(request, params));
26069
+ response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
25984
26070
  }
25985
26071
  //
25986
26072
  // {
@@ -26481,14 +26567,16 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26481
26567
  const id = this.safeString(interest, 'symbol');
26482
26568
  const symbol = this.safeSymbol(id, market, '-', 'swap');
26483
26569
  const openInterest = this.safeNumber(interest, 'openInterest');
26484
- return {
26570
+ return this.safeOpenInterest({
26485
26571
  'symbol': symbol,
26572
+ 'baseVolume': undefined,
26573
+ 'quoteVolume': undefined,
26486
26574
  'openInterestAmount': undefined,
26487
26575
  'openInterestValue': openInterest,
26488
26576
  'timestamp': timestamp,
26489
26577
  'datetime': this.iso8601(timestamp),
26490
26578
  'info': interest,
26491
- };
26579
+ }, market);
26492
26580
  }
26493
26581
  async fetchTicker(symbol, params = {}) {
26494
26582
  /**
@@ -39787,7 +39875,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
39787
39875
  }
39788
39876
  const currency = this.currency(code);
39789
39877
  if (since === undefined) {
39790
- since = this.milliseconds() - 31556952000; // 1yr
39878
+ since = this.milliseconds() - 7776000000; // 90 days
39791
39879
  }
39792
39880
  let request = {
39793
39881
  'coin': currency['code'],
@@ -39943,7 +40031,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
39943
40031
  }
39944
40032
  const currency = this.currency(code);
39945
40033
  if (since === undefined) {
39946
- since = this.milliseconds() - 31556952000; // 1yr
40034
+ since = this.milliseconds() - 7776000000; // 90 days
39947
40035
  }
39948
40036
  let request = {
39949
40037
  'coin': currency['code'],
@@ -42256,10 +42344,17 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42256
42344
  response = await this.privateSpotPostTradeFills(this.extend(request, params));
42257
42345
  }
42258
42346
  else {
42347
+ const orderId = this.safeString(params, 'orderId'); // when order id is not defined, startTime and endTime are required
42259
42348
  if (since !== undefined) {
42260
42349
  request['startTime'] = since;
42261
42350
  }
42351
+ else if (orderId === undefined) {
42352
+ request['startTime'] = 0;
42353
+ }
42262
42354
  [request, params] = this.handleUntilOption('endTime', params, request);
42355
+ if (!('endTime' in request) && (orderId === undefined)) {
42356
+ request['endTime'] = this.milliseconds();
42357
+ }
42263
42358
  response = await this.privateMixGetOrderFills(this.extend(request, params));
42264
42359
  }
42265
42360
  //
@@ -43387,14 +43482,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43387
43482
  const id = this.safeString(interest, 'symbol');
43388
43483
  const symbol = this.safeSymbol(id, market);
43389
43484
  const amount = this.safeNumber(interest, 'amount');
43390
- return {
43485
+ return this.safeOpenInterest({
43391
43486
  'symbol': symbol,
43392
43487
  'openInterestAmount': amount,
43393
43488
  'openInterestValue': undefined,
43394
43489
  'timestamp': timestamp,
43395
43490
  'datetime': this.iso8601(timestamp),
43396
43491
  'info': interest,
43397
- };
43492
+ }, market);
43398
43493
  }
43399
43494
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
43400
43495
  if (!response) {
@@ -48271,14 +48366,14 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
48271
48366
  //
48272
48367
  const timestamp = this.safeInteger(interest, 'timestamp');
48273
48368
  const id = this.safeString(interest, 'symbol');
48274
- return {
48369
+ return this.safeOpenInterest({
48275
48370
  'symbol': this.safeSymbol(id, market),
48276
48371
  'openInterestAmount': this.safeNumber(interest, 'open_interest'),
48277
48372
  'openInterestValue': this.safeNumber(interest, 'open_interest_value'),
48278
48373
  'timestamp': timestamp,
48279
48374
  'datetime': this.iso8601(timestamp),
48280
48375
  'info': interest,
48281
- };
48376
+ }, market);
48282
48377
  }
48283
48378
  async setLeverage(leverage, symbol = undefined, params = {}) {
48284
48379
  /**
@@ -73371,6 +73466,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
73371
73466
  'max': this.safeNumber(lotSizeFilter, 'maxOrderAmt'),
73372
73467
  },
73373
73468
  },
73469
+ 'created': undefined,
73374
73470
  'info': market,
73375
73471
  });
73376
73472
  }
@@ -73545,6 +73641,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
73545
73641
  'max': undefined,
73546
73642
  },
73547
73643
  },
73644
+ 'created': this.safeInteger(market, 'launchTime'),
73548
73645
  'info': market,
73549
73646
  });
73550
73647
  }
@@ -73677,6 +73774,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
73677
73774
  'max': undefined,
73678
73775
  },
73679
73776
  },
73777
+ 'created': this.safeInteger(market, 'launchTime'),
73680
73778
  'info': market,
73681
73779
  });
73682
73780
  }
@@ -75131,10 +75229,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75131
75229
  // }
75132
75230
  //
75133
75231
  const marketId = this.safeString(order, 'symbol');
75134
- let marketType = 'contract';
75232
+ const isContract = ('tpslMode' in order);
75233
+ let marketType = undefined;
75135
75234
  if (market !== undefined) {
75136
75235
  marketType = market['type'];
75137
75236
  }
75237
+ else {
75238
+ marketType = isContract ? 'contract' : 'spot';
75239
+ }
75138
75240
  market = this.safeMarket(marketId, market, undefined, marketType);
75139
75241
  const symbol = market['symbol'];
75140
75242
  const timestamp = this.safeInteger2(order, 'createdTime', 'createdAt');
@@ -77311,10 +77413,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77311
77413
  const timestamp = this.safeInteger(response, 'time');
77312
77414
  const first = this.safeValue(positions, 0, {});
77313
77415
  const position = this.parsePosition(first, market);
77314
- return this.extend(position, {
77315
- 'timestamp': timestamp,
77316
- 'datetime': this.iso8601(timestamp),
77317
- });
77416
+ position['timestamp'] = timestamp;
77417
+ position['datetime'] = this.iso8601(timestamp);
77418
+ return position;
77318
77419
  }
77319
77420
  async fetchUsdcPositions(symbols = undefined, params = {}) {
77320
77421
  await this.loadMarkets();
@@ -77389,7 +77490,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77389
77490
  }
77390
77491
  results.push(this.parsePosition(rawPosition, market));
77391
77492
  }
77392
- return this.filterByArray(results, 'symbol', symbols, false);
77493
+ return this.filterByArrayPositions(results, 'symbol', symbols, false);
77393
77494
  }
77394
77495
  async fetchPositions(symbols = undefined, params = {}) {
77395
77496
  /**
@@ -78072,14 +78173,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78072
78173
  //
78073
78174
  const timestamp = this.safeInteger(interest, 'timestamp');
78074
78175
  const value = this.safeNumber2(interest, 'open_interest', 'openInterest');
78075
- return {
78176
+ return this.safeOpenInterest({
78076
78177
  'symbol': market['symbol'],
78077
78178
  'openInterestAmount': undefined,
78078
78179
  'openInterestValue': value,
78079
78180
  'timestamp': timestamp,
78080
78181
  'datetime': this.iso8601(timestamp),
78081
78182
  'info': interest,
78082
- };
78183
+ }, market);
78083
78184
  }
78084
78185
  async fetchBorrowRate(code, params = {}) {
78085
78186
  /**
@@ -89800,7 +89901,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
89800
89901
  const liquidationPrice = this.safeString(position, 'liq_price');
89801
89902
  const entryPrice = this.safeString(position, 'open_price');
89802
89903
  const unrealizedPnl = this.safeString(position, 'profit_unreal');
89803
- const contractSize = this.safeString(position, 'amount');
89904
+ const contracts = this.safeNumber(position, 'amount');
89804
89905
  const sideInteger = this.safeInteger(position, 'side');
89805
89906
  const side = (sideInteger === 1) ? 'short' : 'long';
89806
89907
  const timestamp = this.safeTimestamp(position, 'update_time');
@@ -89818,8 +89919,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
89818
89919
  'entryPrice': entryPrice,
89819
89920
  'unrealizedPnl': unrealizedPnl,
89820
89921
  'percentage': undefined,
89821
- 'contracts': undefined,
89822
- 'contractSize': contractSize,
89922
+ 'contracts': contracts,
89923
+ 'contractSize': this.safeNumber(market, 'contractSize'),
89823
89924
  'markPrice': undefined,
89824
89925
  'lastPrice': undefined,
89825
89926
  'side': side,
@@ -96349,14 +96450,16 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
96349
96450
  /* harmony export */ "Z": () => (/* binding */ coinspot)
96350
96451
  /* harmony export */ });
96351
96452
  /* harmony import */ var _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4663);
96352
- /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
96453
+ /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
96353
96454
  /* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9292);
96354
- /* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7110);
96455
+ /* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7110);
96456
+ /* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2194);
96355
96457
  // ---------------------------------------------------------------------------
96356
96458
 
96357
96459
 
96358
96460
 
96359
96461
 
96462
+
96360
96463
  // ---------------------------------------------------------------------------
96361
96464
  /**
96362
96465
  * @class coinspot
@@ -96400,6 +96503,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96400
96503
  'fetchLeverageTiers': false,
96401
96504
  'fetchMarginMode': false,
96402
96505
  'fetchMarkOHLCV': false,
96506
+ 'fetchMyTrades': true,
96403
96507
  'fetchOpenInterestHistory': false,
96404
96508
  'fetchOrderBook': true,
96405
96509
  'fetchPosition': false,
@@ -96699,6 +96803,64 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96699
96803
  const trades = this.safeValue(response, 'orders', []);
96700
96804
  return this.parseTrades(trades, market, since, limit);
96701
96805
  }
96806
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
96807
+ /**
96808
+ * @method
96809
+ * @name coinspot#fetchMyTrades
96810
+ * @description fetch all trades made by the user
96811
+ * @param {string} symbol unified market symbol
96812
+ * @param {int} [since] the earliest time in ms to fetch trades for
96813
+ * @param {int} [limit] the maximum number of trades structures to retrieve
96814
+ * @param {object} [params] extra parameters specific to the bitbank api endpoint
96815
+ * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
96816
+ */
96817
+ await this.loadMarkets();
96818
+ const request = {};
96819
+ let market = undefined;
96820
+ if (symbol !== undefined) {
96821
+ market = this.market(symbol);
96822
+ }
96823
+ if (since !== undefined) {
96824
+ request['startdate'] = this.yyyymmdd(since);
96825
+ }
96826
+ const response = await this.privatePostRoMyTransactions(this.extend(request, params));
96827
+ // {
96828
+ // status: 'ok',
96829
+ // buyorders: [
96830
+ // {
96831
+ // otc: false,
96832
+ // market: 'ALGO/AUD',
96833
+ // amount: 386.95197925,
96834
+ // created: '2022-10-20T09:56:44.502Z',
96835
+ // audfeeExGst: 1.80018002,
96836
+ // audGst: 0.180018,
96837
+ // audtotal: 200
96838
+ // },
96839
+ // ],
96840
+ // sellorders: [
96841
+ // {
96842
+ // otc: false,
96843
+ // market: 'SOLO/ALGO',
96844
+ // amount: 154.52345614,
96845
+ // total: 115.78858204658796,
96846
+ // created: '2022-04-16T09:36:43.698Z',
96847
+ // audfeeExGst: 1.08995731,
96848
+ // audGst: 0.10899573,
96849
+ // audtotal: 118.7
96850
+ // },
96851
+ // ]
96852
+ // }
96853
+ const buyTrades = this.safeValue(response, 'buyorders', []);
96854
+ for (let i = 0; i < buyTrades.length; i++) {
96855
+ buyTrades[i]['side'] = 'buy';
96856
+ }
96857
+ const sellTrades = this.safeValue(response, 'sellorders', []);
96858
+ for (let i = 0; i < sellTrades.length; i++) {
96859
+ sellTrades[i]['side'] = 'sell';
96860
+ }
96861
+ const trades = this.arrayConcat(buyTrades, sellTrades);
96862
+ return this.parseTrades(trades, market, since, limit);
96863
+ }
96702
96864
  parseTrade(trade, market = undefined) {
96703
96865
  //
96704
96866
  // public fetchTrades
@@ -96712,12 +96874,47 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96712
96874
  // "market":"BTC/AUD"
96713
96875
  // }
96714
96876
  //
96715
- const priceString = this.safeString(trade, 'rate');
96877
+ // private fetchMyTrades
96878
+ // {
96879
+ // otc: false,
96880
+ // market: 'ALGO/AUD',
96881
+ // amount: 386.95197925,
96882
+ // created: '2022-10-20T09:56:44.502Z',
96883
+ // audfeeExGst: 1.80018002,
96884
+ // audGst: 0.180018,
96885
+ // audtotal: 200,
96886
+ // total: 200,
96887
+ // side: 'buy',
96888
+ // price: 0.5168600000125209
96889
+ // }
96890
+ let timestamp = undefined;
96891
+ let priceString = undefined;
96892
+ let fee = undefined;
96893
+ const audTotal = this.safeString(trade, 'audtotal');
96894
+ const costString = this.safeString(trade, 'total', audTotal);
96895
+ const side = this.safeString(trade, 'side');
96716
96896
  const amountString = this.safeString(trade, 'amount');
96717
- const costString = this.safeNumber(trade, 'total');
96718
- const timestamp = this.safeInteger(trade, 'solddate');
96719
96897
  const marketId = this.safeString(trade, 'market');
96720
96898
  const symbol = this.safeSymbol(marketId, market, '/');
96899
+ const solddate = this.safeInteger(trade, 'solddate');
96900
+ if (solddate !== undefined) {
96901
+ priceString = this.safeString(trade, 'rate');
96902
+ timestamp = solddate;
96903
+ }
96904
+ else {
96905
+ priceString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise.stringDiv */ .O.stringDiv(costString, amountString);
96906
+ const createdString = this.safeString(trade, 'created');
96907
+ timestamp = this.parse8601(createdString);
96908
+ const audfeeExGst = this.safeString(trade, 'audfeeExGst');
96909
+ const audGst = this.safeString(trade, 'audGst');
96910
+ // The transaction fee which consumers pay is inclusive of GST by default
96911
+ const feeCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise.stringAdd */ .O.stringAdd(audfeeExGst, audGst);
96912
+ const feeCurrencyId = 'AUD';
96913
+ fee = {
96914
+ 'cost': this.parseNumber(feeCost),
96915
+ 'currency': this.safeCurrencyCode(feeCurrencyId),
96916
+ };
96917
+ }
96721
96918
  return this.safeTrade({
96722
96919
  'info': trade,
96723
96920
  'id': undefined,
@@ -96726,12 +96923,12 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96726
96923
  'datetime': this.iso8601(timestamp),
96727
96924
  'order': undefined,
96728
96925
  'type': undefined,
96729
- 'side': undefined,
96926
+ 'side': side,
96730
96927
  'takerOrMaker': undefined,
96731
- 'price': priceString,
96732
- 'amount': amountString,
96733
- 'cost': costString,
96734
- 'fee': undefined,
96928
+ 'price': this.parseNumber(priceString),
96929
+ 'amount': this.parseNumber(amountString),
96930
+ 'cost': this.parseNumber(costString),
96931
+ 'fee': fee,
96735
96932
  }, market);
96736
96933
  }
96737
96934
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -96751,7 +96948,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96751
96948
  await this.loadMarkets();
96752
96949
  const method = 'privatePostMy' + this.capitalize(side);
96753
96950
  if (type === 'market') {
96754
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() allows limit orders only');
96951
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' createOrder() allows limit orders only');
96755
96952
  }
96756
96953
  const market = this.market(symbol);
96757
96954
  const request = {
@@ -96773,7 +96970,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96773
96970
  */
96774
96971
  const side = this.safeString(params, 'side');
96775
96972
  if (side !== 'buy' && side !== 'sell') {
96776
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelOrder() requires a side parameter, "buy" or "sell"');
96973
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' cancelOrder() requires a side parameter, "buy" or "sell"');
96777
96974
  }
96778
96975
  params = this.omit(params, 'side');
96779
96976
  const method = 'privatePostMy' + this.capitalize(side) + 'Cancel';
@@ -96791,7 +96988,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96791
96988
  headers = {
96792
96989
  'Content-Type': 'application/json',
96793
96990
  'key': this.apiKey,
96794
- 'sign': this.hmac(this.encode(body), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__/* .sha512 */ .o),
96991
+ 'sign': this.hmac(this.encode(body), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__/* .sha512 */ .o),
96795
96992
  };
96796
96993
  }
96797
96994
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
@@ -99764,7 +99961,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
99764
99961
  const marketInner = this.safeMarket(marketId, undefined, undefined, 'contract');
99765
99962
  result.push(this.parsePosition(entry, marketInner));
99766
99963
  }
99767
- return this.filterByArray(result, 'symbol', undefined, false);
99964
+ return this.filterByArrayPositions(result, 'symbol', undefined, false);
99768
99965
  }
99769
99966
  parsePosition(position, market = undefined) {
99770
99967
  //
@@ -103567,7 +103764,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
103567
103764
  side = 'sell';
103568
103765
  }
103569
103766
  }
103570
- return {
103767
+ return this.safePosition({
103571
103768
  'info': position,
103572
103769
  'id': undefined,
103573
103770
  'symbol': symbol,
@@ -103593,7 +103790,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
103593
103790
  'marginRatio': undefined,
103594
103791
  'stopLossPrice': undefined,
103595
103792
  'takeProfitPrice': undefined,
103596
- };
103793
+ });
103597
103794
  }
103598
103795
  parseOrderStatus(status) {
103599
103796
  const statuses = {
@@ -104684,7 +104881,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
104684
104881
  //
104685
104882
  const timestamp = this.safeIntegerProduct(interest, 'timestamp', 0.001);
104686
104883
  const marketId = this.safeString(interest, 'symbol');
104687
- return {
104884
+ return this.safeOpenInterest({
104688
104885
  'symbol': this.safeSymbol(marketId, market),
104689
104886
  'baseVolume': this.safeNumber(interest, 'oi_value'),
104690
104887
  'quoteVolume': this.safeNumber(interest, 'oi_value_usd'),
@@ -104693,7 +104890,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
104693
104890
  'timestamp': timestamp,
104694
104891
  'datetime': this.iso8601(timestamp),
104695
104892
  'info': interest,
104696
- };
104893
+ }, market);
104697
104894
  }
104698
104895
  async fetchLeverage(symbol, params = {}) {
104699
104896
  /**
@@ -105471,7 +105668,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
105471
105668
  const defaultCode = this.safeValue(this.options, 'code', 'BTC');
105472
105669
  const options = this.safeValue(this.options, methodName, {});
105473
105670
  const code = this.safeValue(options, 'code', defaultCode);
105474
- return this.safeValue2(params, 'code', code);
105671
+ return this.safeValue(params, 'code', code);
105475
105672
  }
105476
105673
  async fetchStatus(params = {}) {
105477
105674
  /**
@@ -134993,10 +135190,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134993
135190
  }
134994
135191
  const timestamp = this.safeInteger(response, 'ts');
134995
135192
  const parsed = this.parsePosition(this.extend(position, omitted));
134996
- return this.extend(parsed, {
134997
- 'timestamp': timestamp,
134998
- 'datetime': this.iso8601(timestamp),
134999
- });
135193
+ parsed['timestamp'] = timestamp;
135194
+ parsed['datetime'] = this.iso8601(timestamp);
135195
+ return parsed;
135000
135196
  }
135001
135197
  parseLedgerEntryType(type) {
135002
135198
  const types = {
@@ -135484,10 +135680,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135484
135680
  const data = this.safeValue(response, 'data', []);
135485
135681
  const openInterest = this.parseOpenInterest(data[0], market);
135486
135682
  const timestamp = this.safeInteger(response, 'ts');
135487
- return this.extend(openInterest, {
135488
- 'timestamp': timestamp,
135489
- 'datetime': this.iso8601(timestamp),
135490
- });
135683
+ openInterest['timestamp'] = timestamp;
135684
+ openInterest['datetime'] = this.iso8601(timestamp);
135685
+ return openInterest;
135491
135686
  }
135492
135687
  parseOpenInterest(interest, market = undefined) {
135493
135688
  //
@@ -135545,7 +135740,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135545
135740
  const timestamp = this.safeInteger(interest, 'ts');
135546
135741
  const amount = this.safeNumber(interest, 'volume');
135547
135742
  const value = this.safeNumber(interest, 'value');
135548
- return {
135743
+ return this.safeOpenInterest({
135549
135744
  'symbol': this.safeString(market, 'symbol'),
135550
135745
  'baseVolume': amount,
135551
135746
  'quoteVolume': value,
@@ -135554,7 +135749,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135554
135749
  'timestamp': timestamp,
135555
135750
  'datetime': this.iso8601(timestamp),
135556
135751
  'info': interest,
135557
- };
135752
+ }, market);
135558
135753
  }
135559
135754
  async borrowMargin(code, amount, symbol = undefined, params = {}) {
135560
135755
  /**
@@ -178266,7 +178461,6 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
178266
178461
  for (let i = 0; i < types.length; i++) {
178267
178462
  promises.push(this.fetchMarketsByType(types[i], params));
178268
178463
  }
178269
- // why not both ¯\_(ツ)_/¯
178270
178464
  promises = await Promise.all(promises);
178271
178465
  for (let i = 0; i < promises.length; i++) {
178272
178466
  result = this.arrayConcat(result, promises[i]);
@@ -178400,6 +178594,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
178400
178594
  'expiryDatetime': this.iso8601(expiry),
178401
178595
  'strike': strikePrice,
178402
178596
  'optionType': optionType,
178597
+ 'created': this.safeInteger(market, 'listTime'),
178403
178598
  'precision': {
178404
178599
  'amount': this.safeNumber(market, 'lotSz'),
178405
178600
  'price': this.parseNumber(tickSize),
@@ -179121,6 +179316,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
179121
179316
  }
179122
179317
  }
179123
179318
  else if (price === 'index') {
179319
+ request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
179124
179320
  if (isHistoryCandles) {
179125
179321
  response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
179126
179322
  }
@@ -183586,7 +183782,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183586
183782
  openInterestAmount = this.safeNumber(interest, 'oi');
183587
183783
  openInterestValue = this.safeNumber(interest, 'oiCcy');
183588
183784
  }
183589
- return {
183785
+ return this.safeOpenInterest({
183590
183786
  'symbol': this.safeSymbol(id),
183591
183787
  'baseVolume': baseVolume,
183592
183788
  'quoteVolume': quoteVolume,
@@ -183595,7 +183791,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183595
183791
  'timestamp': timestamp,
183596
183792
  'datetime': this.iso8601(timestamp),
183597
183793
  'info': interest,
183598
- };
183794
+ }, market);
183599
183795
  }
183600
183796
  setSandboxMode(enable) {
183601
183797
  super.setSandboxMode(enable);
@@ -189259,6 +189455,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
189259
189455
  '21352': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
189260
189456
  '21353': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
189261
189457
  '21354': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
189458
+ '21359': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
189262
189459
  '21360': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
189263
189460
  '24106': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
189264
189461
  '24201': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeNotAvailable,
@@ -195037,14 +195234,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195037
195234
  * @param {object} [params] extra parameters specific to the binance api endpoint
195038
195235
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
195039
195236
  */
195040
- if (limit !== undefined) {
195041
- if ((limit !== 5) && (limit !== 10) && (limit !== 20) && (limit !== 50) && (limit !== 100) && (limit !== 500) && (limit !== 1000)) {
195042
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook limit argument must be undefined, 5, 10, 20, 50, 100, 500 or 1000');
195043
- }
195044
- }
195045
- //
195046
195237
  await this.loadMarkets();
195047
- symbols = this.marketSymbols(symbols);
195238
+ symbols = this.marketSymbols(symbols, undefined, false, true, true);
195048
195239
  const firstMarket = this.market(symbols[0]);
195049
195240
  let type = firstMarket['type'];
195050
195241
  if (firstMarket['contract']) {
@@ -195307,7 +195498,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195307
195498
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
195308
195499
  */
195309
195500
  await this.loadMarkets();
195310
- symbols = this.marketSymbols(symbols);
195501
+ symbols = this.marketSymbols(symbols, undefined, false, true, true);
195311
195502
  const options = this.safeValue(this.options, 'watchTradesForSymbols', {});
195312
195503
  const name = this.safeString(options, 'name', 'trade');
195313
195504
  const firstMarket = this.market(symbols[0]);
@@ -195782,7 +195973,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195782
195973
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
195783
195974
  */
195784
195975
  await this.loadMarkets();
195785
- symbols = this.marketSymbols(symbols);
195976
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
195786
195977
  const marketIds = this.marketIds(symbols);
195787
195978
  let market = undefined;
195788
195979
  let type = undefined;
@@ -233764,10 +233955,10 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
233764
233955
  },
233765
233956
  'urls': {
233766
233957
  'test': {
233767
- 'ws': 'wss://testnet.phemex.com/ws',
233958
+ 'ws': 'wss://testnet-api.phemex.com/ws',
233768
233959
  },
233769
233960
  'api': {
233770
- 'ws': 'wss://phemex.com/ws',
233961
+ 'ws': 'wss://ws.phemex.com',
233771
233962
  },
233772
233963
  },
233773
233964
  'options': {
@@ -262047,6 +262238,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262047
262238
  'fetchMarginMode': false,
262048
262239
  'fetchMarkets': true,
262049
262240
  'fetchMarkOHLCV': false,
262241
+ 'fetchMyTrades': true,
262050
262242
  'fetchOHLCV': true,
262051
262243
  'fetchOpenInterestHistory': false,
262052
262244
  'fetchOpenOrders': true,
@@ -262272,13 +262464,14 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262272
262464
  // "stockPrec": "3", // Stock currency precision
262273
262465
  // "moneyPrec": "2", // Precision of money currency
262274
262466
  // "feePrec": "4", // Fee precision
262275
- // "makerFee": "0.001", // Default maker fee ratio
262276
- // "takerFee": "0.001", // Default taker fee ratio
262467
+ // "makerFee": "0.1", // Default maker fee ratio
262468
+ // "takerFee": "0.1", // Default taker fee ratio
262277
262469
  // "minAmount": "0.001", // Minimal amount of stock to trade
262278
262470
  // "minTotal": "0.001", // Minimal amount of money to trade
262279
262471
  // "tradesEnabled": true, // Is trading enabled
262280
262472
  // "isCollateral": true, // Is margin trading enabled
262281
- // "type": "spot" // Market type. Possible values: "spot", "futures"
262473
+ // "type": "spot", // Market type. Possible values: "spot", "futures"
262474
+ // "maxTotal": "1000000000" // Maximum total(amount * price) of money to trade
262282
262475
  // },
262283
262476
  // {
262284
262477
  // ...
@@ -262320,6 +262513,10 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262320
262513
  else {
262321
262514
  type = 'spot';
262322
262515
  }
262516
+ const takerFeeRate = this.safeString(market, 'takerFee');
262517
+ const taker = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(takerFeeRate, '100');
262518
+ const makerFeeRate = this.safeString(market, 'makerFee');
262519
+ const maker = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(makerFeeRate, '100');
262323
262520
  const entry = {
262324
262521
  'id': id,
262325
262522
  'symbol': symbol,
@@ -262339,8 +262536,8 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262339
262536
  'contract': contract,
262340
262537
  'linear': linear,
262341
262538
  'inverse': inverse,
262342
- 'taker': this.safeNumber(market, 'makerFee'),
262343
- 'maker': this.safeNumber(market, 'takerFee'),
262539
+ 'taker': this.parseNumber(taker),
262540
+ 'maker': this.parseNumber(maker),
262344
262541
  'contractSize': contractSize,
262345
262542
  'expiry': undefined,
262346
262543
  'expiryDatetime': undefined,
@@ -262365,7 +262562,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262365
262562
  },
262366
262563
  'cost': {
262367
262564
  'min': this.safeNumber(market, 'minTotal'),
262368
- 'max': undefined,
262565
+ 'max': this.safeNumber(market, 'maxTotal'),
262369
262566
  },
262370
262567
  },
262371
262568
  'info': market,
@@ -262809,6 +263006,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262809
263006
  /**
262810
263007
  * @method
262811
263008
  * @name whitebit#fetchOrderBook
263009
+ * @see https://whitebit-exchange.github.io/api-docs/public/http-v4/#orderbook
262812
263010
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
262813
263011
  * @param {string} symbol unified symbol of the market to fetch the order book for
262814
263012
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -262821,7 +263019,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262821
263019
  'market': market['id'],
262822
263020
  };
262823
263021
  if (limit !== undefined) {
262824
- request['depth'] = limit; // default = 50, maximum = 100
263022
+ request['limit'] = limit; // default = 100, maximum = 100
262825
263023
  }
262826
263024
  const response = await this.v4PublicGetOrderbookMarket(this.extend(request, params));
262827
263025
  //
@@ -262843,7 +263041,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262843
263041
  // ]
262844
263042
  // }
262845
263043
  //
262846
- const timestamp = this.parseToInt(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(this.safeString(response, 'timestamp'), '1000'));
263044
+ const timestamp = this.safeIntegerProduct(response, 'timestamp', 1000);
262847
263045
  return this.parseOrderBook(response, symbol, timestamp);
262848
263046
  }
262849
263047
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -263055,10 +263253,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
263055
263253
  }
263056
263254
  limit = Math.min(limit, maxLimit);
263057
263255
  const start = this.parseToInt(since / 1000);
263058
- const duration = this.parseTimeframe(timeframe);
263059
- const end = this.sum(start, duration * limit);
263060
263256
  request['start'] = start;
263061
- request['end'] = end;
263062
263257
  }
263063
263258
  if (limit !== undefined) {
263064
263259
  request['limit'] = Math.min(limit, 1440);
@@ -276418,7 +276613,7 @@ SOFTWARE.
276418
276613
 
276419
276614
  //-----------------------------------------------------------------------------
276420
276615
  // this is updated by vss.js when building
276421
- const version = '4.1.10';
276616
+ const version = '4.1.12';
276422
276617
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
276423
276618
  //-----------------------------------------------------------------------------
276424
276619