ccxt 4.1.10 → 4.1.11

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 (56) 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 +215 -78
  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 +21 -10
  9. package/dist/cjs/src/bingx.js +15 -9
  10. package/dist/cjs/src/bitget.js +2 -2
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/bybit.js +2 -2
  13. package/dist/cjs/src/coinex.js +3 -3
  14. package/dist/cjs/src/coinspot.js +103 -8
  15. package/dist/cjs/src/delta.js +2 -2
  16. package/dist/cjs/src/deribit.js +1 -1
  17. package/dist/cjs/src/huobi.js +5 -6
  18. package/dist/cjs/src/okx.js +3 -3
  19. package/dist/cjs/src/pro/binance.js +3 -9
  20. package/dist/cjs/src/pro/phemex.js +2 -2
  21. package/dist/cjs/src/whitebit.js +14 -11
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/binance.d.ts +3 -0
  25. package/js/src/abstract/binancecoinm.d.ts +3 -0
  26. package/js/src/abstract/binanceus.d.ts +3 -0
  27. package/js/src/abstract/binanceusdm.d.ts +3 -0
  28. package/js/src/abstract/bingx.d.ts +1 -0
  29. package/js/src/base/Exchange.d.ts +7 -6
  30. package/js/src/base/Exchange.js +30 -2
  31. package/js/src/base/types.d.ts +10 -0
  32. package/js/src/binance.d.ts +5 -13
  33. package/js/src/binance.js +21 -10
  34. package/js/src/bingx.d.ts +2 -16
  35. package/js/src/bingx.js +15 -9
  36. package/js/src/bitget.d.ts +2 -16
  37. package/js/src/bitget.js +2 -2
  38. package/js/src/bitmart.d.ts +2 -16
  39. package/js/src/bitmart.js +2 -2
  40. package/js/src/bybit.d.ts +5 -19
  41. package/js/src/bybit.js +2 -2
  42. package/js/src/coinex.js +3 -3
  43. package/js/src/coinspot.d.ts +1 -0
  44. package/js/src/coinspot.js +103 -8
  45. package/js/src/delta.d.ts +2 -20
  46. package/js/src/delta.js +2 -2
  47. package/js/src/deribit.js +1 -1
  48. package/js/src/gate.d.ts +2 -2
  49. package/js/src/huobi.d.ts +3 -12
  50. package/js/src/huobi.js +5 -6
  51. package/js/src/okx.d.ts +3 -21
  52. package/js/src/okx.js +3 -3
  53. package/js/src/pro/binance.js +3 -9
  54. package/js/src/pro/phemex.js +2 -2
  55. package/js/src/whitebit.js +14 -11
  56. 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,
@@ -18339,6 +18370,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18339
18370
  },
18340
18371
  },
18341
18372
  'info': market,
18373
+ 'created': this.safeInteger(market, 'onboardDate'), // present in inverse & linear apis
18342
18374
  };
18343
18375
  if ('PRICE_FILTER' in filtersByType) {
18344
18376
  const filter = this.safeValue(filtersByType, 'PRICE_FILTER', {});
@@ -18666,7 +18698,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18666
18698
  // "unrealizedProfit":"0.00000000",
18667
18699
  // "positionInitialMargin":"0",
18668
18700
  // "openOrderInitialMargin":"0",
18669
- // "leverage":"20",
18701
+ // "leverage":"21",
18670
18702
  // "isolated":false,
18671
18703
  // "entryPrice":"0.00000",
18672
18704
  // "maxNotional":"5000000",
@@ -19168,6 +19200,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19168
19200
  await this.loadMarkets();
19169
19201
  let type = undefined;
19170
19202
  let market = undefined;
19203
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
19171
19204
  if (symbols !== undefined) {
19172
19205
  const first = this.safeString(symbols, 0);
19173
19206
  market = this.market(first);
@@ -24340,7 +24373,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24340
24373
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError(this.id + ' userDataStream endpoint requires `apiKey` credential');
24341
24374
  }
24342
24375
  }
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')) {
24376
+ 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
24377
  this.checkRequiredCredentials();
24345
24378
  if (method === 'POST' && ((path === 'order') || (path === 'sor/order'))) {
24346
24379
  // inject in implicit API calls
@@ -25095,7 +25128,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25095
25128
  // ]
25096
25129
  //
25097
25130
  if (market['option']) {
25098
- return this.parseOpenInterests(response, market);
25131
+ const result = this.parseOpenInterests(response, market);
25132
+ for (let i = 0; i < result.length; i++) {
25133
+ const item = result[i];
25134
+ if (item['symbol'] === symbol) {
25135
+ return item;
25136
+ }
25137
+ }
25099
25138
  }
25100
25139
  else {
25101
25140
  return this.parseOpenInterest(response, market);
@@ -25108,7 +25147,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25108
25147
  const value = this.safeNumber2(interest, 'sumOpenInterestValue', 'sumOpenInterestUsd');
25109
25148
  // Inverse returns the number of contracts different from the base or quote volume in this case
25110
25149
  // compared with https://www.binance.com/en/futures/funding-history/quarterly/4
25111
- return {
25150
+ return this.safeOpenInterest({
25112
25151
  'symbol': this.safeSymbol(id, market, undefined, 'contract'),
25113
25152
  'baseVolume': market['inverse'] ? undefined : amount,
25114
25153
  'quoteVolume': value,
@@ -25117,7 +25156,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25117
25156
  'timestamp': timestamp,
25118
25157
  'datetime': this.iso8601(timestamp),
25119
25158
  'info': interest,
25120
- };
25159
+ }, market);
25121
25160
  }
25122
25161
  }
25123
25162
 
@@ -25483,6 +25522,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25483
25522
  },
25484
25523
  },
25485
25524
  },
25525
+ 'v3': {
25526
+ 'public': {
25527
+ 'get': {
25528
+ 'quote/klines': 1,
25529
+ },
25530
+ },
25531
+ },
25486
25532
  },
25487
25533
  'contract': {
25488
25534
  'v1': {
@@ -25940,12 +25986,12 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25940
25986
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
25941
25987
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
25942
25988
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
25989
+ * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
25943
25990
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
25944
25991
  * @param {string} timeframe the length of time each candle represents
25945
25992
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
25946
25993
  * @param {int} [limit] the maximum amount of candles to fetch
25947
25994
  * @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
25995
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
25950
25996
  * @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
25997
  * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
@@ -25967,20 +26013,17 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
25967
26013
  if (limit !== undefined) {
25968
26014
  request['limit'] = limit;
25969
26015
  }
25970
- else {
25971
- request['limit'] = 50;
25972
- }
25973
- const until = this.safeInteger2(params, 'until', 'startTime');
26016
+ const until = this.safeInteger2(params, 'until', 'endTime');
25974
26017
  if (until !== undefined) {
25975
26018
  params = this.omit(params, ['until']);
25976
- request['startTime'] = until;
26019
+ request['endTime'] = until;
25977
26020
  }
25978
26021
  let response = undefined;
25979
26022
  if (market['spot']) {
25980
26023
  response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
25981
26024
  }
25982
26025
  else {
25983
- response = await this.swapV2PublicGetQuoteKlines(this.extend(request, params));
26026
+ response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
25984
26027
  }
25985
26028
  //
25986
26029
  // {
@@ -26481,14 +26524,16 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26481
26524
  const id = this.safeString(interest, 'symbol');
26482
26525
  const symbol = this.safeSymbol(id, market, '-', 'swap');
26483
26526
  const openInterest = this.safeNumber(interest, 'openInterest');
26484
- return {
26527
+ return this.safeOpenInterest({
26485
26528
  'symbol': symbol,
26529
+ 'baseVolume': undefined,
26530
+ 'quoteVolume': undefined,
26486
26531
  'openInterestAmount': undefined,
26487
26532
  'openInterestValue': openInterest,
26488
26533
  'timestamp': timestamp,
26489
26534
  'datetime': this.iso8601(timestamp),
26490
26535
  'info': interest,
26491
- };
26536
+ }, market);
26492
26537
  }
26493
26538
  async fetchTicker(symbol, params = {}) {
26494
26539
  /**
@@ -43387,14 +43432,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43387
43432
  const id = this.safeString(interest, 'symbol');
43388
43433
  const symbol = this.safeSymbol(id, market);
43389
43434
  const amount = this.safeNumber(interest, 'amount');
43390
- return {
43435
+ return this.safeOpenInterest({
43391
43436
  'symbol': symbol,
43392
43437
  'openInterestAmount': amount,
43393
43438
  'openInterestValue': undefined,
43394
43439
  'timestamp': timestamp,
43395
43440
  'datetime': this.iso8601(timestamp),
43396
43441
  'info': interest,
43397
- };
43442
+ }, market);
43398
43443
  }
43399
43444
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
43400
43445
  if (!response) {
@@ -48271,14 +48316,14 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
48271
48316
  //
48272
48317
  const timestamp = this.safeInteger(interest, 'timestamp');
48273
48318
  const id = this.safeString(interest, 'symbol');
48274
- return {
48319
+ return this.safeOpenInterest({
48275
48320
  'symbol': this.safeSymbol(id, market),
48276
48321
  'openInterestAmount': this.safeNumber(interest, 'open_interest'),
48277
48322
  'openInterestValue': this.safeNumber(interest, 'open_interest_value'),
48278
48323
  'timestamp': timestamp,
48279
48324
  'datetime': this.iso8601(timestamp),
48280
48325
  'info': interest,
48281
- };
48326
+ }, market);
48282
48327
  }
48283
48328
  async setLeverage(leverage, symbol = undefined, params = {}) {
48284
48329
  /**
@@ -78072,14 +78117,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78072
78117
  //
78073
78118
  const timestamp = this.safeInteger(interest, 'timestamp');
78074
78119
  const value = this.safeNumber2(interest, 'open_interest', 'openInterest');
78075
- return {
78120
+ return this.safeOpenInterest({
78076
78121
  'symbol': market['symbol'],
78077
78122
  'openInterestAmount': undefined,
78078
78123
  'openInterestValue': value,
78079
78124
  'timestamp': timestamp,
78080
78125
  'datetime': this.iso8601(timestamp),
78081
78126
  'info': interest,
78082
- };
78127
+ }, market);
78083
78128
  }
78084
78129
  async fetchBorrowRate(code, params = {}) {
78085
78130
  /**
@@ -89800,7 +89845,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
89800
89845
  const liquidationPrice = this.safeString(position, 'liq_price');
89801
89846
  const entryPrice = this.safeString(position, 'open_price');
89802
89847
  const unrealizedPnl = this.safeString(position, 'profit_unreal');
89803
- const contractSize = this.safeString(position, 'amount');
89848
+ const contracts = this.safeNumber(position, 'amount');
89804
89849
  const sideInteger = this.safeInteger(position, 'side');
89805
89850
  const side = (sideInteger === 1) ? 'short' : 'long';
89806
89851
  const timestamp = this.safeTimestamp(position, 'update_time');
@@ -89818,8 +89863,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
89818
89863
  'entryPrice': entryPrice,
89819
89864
  'unrealizedPnl': unrealizedPnl,
89820
89865
  'percentage': undefined,
89821
- 'contracts': undefined,
89822
- 'contractSize': contractSize,
89866
+ 'contracts': contracts,
89867
+ 'contractSize': this.safeNumber(market, 'contractSize'),
89823
89868
  'markPrice': undefined,
89824
89869
  'lastPrice': undefined,
89825
89870
  'side': side,
@@ -96349,14 +96394,16 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
96349
96394
  /* harmony export */ "Z": () => (/* binding */ coinspot)
96350
96395
  /* harmony export */ });
96351
96396
  /* 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);
96397
+ /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
96353
96398
  /* 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);
96399
+ /* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7110);
96400
+ /* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2194);
96355
96401
  // ---------------------------------------------------------------------------
96356
96402
 
96357
96403
 
96358
96404
 
96359
96405
 
96406
+
96360
96407
  // ---------------------------------------------------------------------------
96361
96408
  /**
96362
96409
  * @class coinspot
@@ -96400,6 +96447,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96400
96447
  'fetchLeverageTiers': false,
96401
96448
  'fetchMarginMode': false,
96402
96449
  'fetchMarkOHLCV': false,
96450
+ 'fetchMyTrades': true,
96403
96451
  'fetchOpenInterestHistory': false,
96404
96452
  'fetchOrderBook': true,
96405
96453
  'fetchPosition': false,
@@ -96699,6 +96747,64 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96699
96747
  const trades = this.safeValue(response, 'orders', []);
96700
96748
  return this.parseTrades(trades, market, since, limit);
96701
96749
  }
96750
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
96751
+ /**
96752
+ * @method
96753
+ * @name coinspot#fetchMyTrades
96754
+ * @description fetch all trades made by the user
96755
+ * @param {string} symbol unified market symbol
96756
+ * @param {int} [since] the earliest time in ms to fetch trades for
96757
+ * @param {int} [limit] the maximum number of trades structures to retrieve
96758
+ * @param {object} [params] extra parameters specific to the bitbank api endpoint
96759
+ * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
96760
+ */
96761
+ await this.loadMarkets();
96762
+ const request = {};
96763
+ let market = undefined;
96764
+ if (symbol !== undefined) {
96765
+ market = this.market(symbol);
96766
+ }
96767
+ if (since !== undefined) {
96768
+ request['startdate'] = this.yyyymmdd(since);
96769
+ }
96770
+ const response = await this.privatePostRoMyTransactions(this.extend(request, params));
96771
+ // {
96772
+ // status: 'ok',
96773
+ // buyorders: [
96774
+ // {
96775
+ // otc: false,
96776
+ // market: 'ALGO/AUD',
96777
+ // amount: 386.95197925,
96778
+ // created: '2022-10-20T09:56:44.502Z',
96779
+ // audfeeExGst: 1.80018002,
96780
+ // audGst: 0.180018,
96781
+ // audtotal: 200
96782
+ // },
96783
+ // ],
96784
+ // sellorders: [
96785
+ // {
96786
+ // otc: false,
96787
+ // market: 'SOLO/ALGO',
96788
+ // amount: 154.52345614,
96789
+ // total: 115.78858204658796,
96790
+ // created: '2022-04-16T09:36:43.698Z',
96791
+ // audfeeExGst: 1.08995731,
96792
+ // audGst: 0.10899573,
96793
+ // audtotal: 118.7
96794
+ // },
96795
+ // ]
96796
+ // }
96797
+ const buyTrades = this.safeValue(response, 'buyorders', []);
96798
+ for (let i = 0; i < buyTrades.length; i++) {
96799
+ buyTrades[i]['side'] = 'buy';
96800
+ }
96801
+ const sellTrades = this.safeValue(response, 'sellorders', []);
96802
+ for (let i = 0; i < sellTrades.length; i++) {
96803
+ sellTrades[i]['side'] = 'sell';
96804
+ }
96805
+ const trades = this.arrayConcat(buyTrades, sellTrades);
96806
+ return this.parseTrades(trades, market, since, limit);
96807
+ }
96702
96808
  parseTrade(trade, market = undefined) {
96703
96809
  //
96704
96810
  // public fetchTrades
@@ -96712,12 +96818,47 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96712
96818
  // "market":"BTC/AUD"
96713
96819
  // }
96714
96820
  //
96715
- const priceString = this.safeString(trade, 'rate');
96821
+ // private fetchMyTrades
96822
+ // {
96823
+ // otc: false,
96824
+ // market: 'ALGO/AUD',
96825
+ // amount: 386.95197925,
96826
+ // created: '2022-10-20T09:56:44.502Z',
96827
+ // audfeeExGst: 1.80018002,
96828
+ // audGst: 0.180018,
96829
+ // audtotal: 200,
96830
+ // total: 200,
96831
+ // side: 'buy',
96832
+ // price: 0.5168600000125209
96833
+ // }
96834
+ let timestamp = undefined;
96835
+ let priceString = undefined;
96836
+ let fee = undefined;
96837
+ const audTotal = this.safeString(trade, 'audtotal');
96838
+ const costString = this.safeString(trade, 'total', audTotal);
96839
+ const side = this.safeString(trade, 'side');
96716
96840
  const amountString = this.safeString(trade, 'amount');
96717
- const costString = this.safeNumber(trade, 'total');
96718
- const timestamp = this.safeInteger(trade, 'solddate');
96719
96841
  const marketId = this.safeString(trade, 'market');
96720
96842
  const symbol = this.safeSymbol(marketId, market, '/');
96843
+ const solddate = this.safeInteger(trade, 'solddate');
96844
+ if (solddate !== undefined) {
96845
+ priceString = this.safeString(trade, 'rate');
96846
+ timestamp = solddate;
96847
+ }
96848
+ else {
96849
+ priceString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise.stringDiv */ .O.stringDiv(costString, amountString);
96850
+ const createdString = this.safeString(trade, 'created');
96851
+ timestamp = this.parse8601(createdString);
96852
+ const audfeeExGst = this.safeString(trade, 'audfeeExGst');
96853
+ const audGst = this.safeString(trade, 'audGst');
96854
+ // The transaction fee which consumers pay is inclusive of GST by default
96855
+ const feeCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__/* .Precise.stringAdd */ .O.stringAdd(audfeeExGst, audGst);
96856
+ const feeCurrencyId = 'AUD';
96857
+ fee = {
96858
+ 'cost': this.parseNumber(feeCost),
96859
+ 'currency': this.safeCurrencyCode(feeCurrencyId),
96860
+ };
96861
+ }
96721
96862
  return this.safeTrade({
96722
96863
  'info': trade,
96723
96864
  'id': undefined,
@@ -96726,12 +96867,12 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96726
96867
  'datetime': this.iso8601(timestamp),
96727
96868
  'order': undefined,
96728
96869
  'type': undefined,
96729
- 'side': undefined,
96870
+ 'side': side,
96730
96871
  'takerOrMaker': undefined,
96731
- 'price': priceString,
96732
- 'amount': amountString,
96733
- 'cost': costString,
96734
- 'fee': undefined,
96872
+ 'price': this.parseNumber(priceString),
96873
+ 'amount': this.parseNumber(amountString),
96874
+ 'cost': this.parseNumber(costString),
96875
+ 'fee': fee,
96735
96876
  }, market);
96736
96877
  }
96737
96878
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -96751,7 +96892,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96751
96892
  await this.loadMarkets();
96752
96893
  const method = 'privatePostMy' + this.capitalize(side);
96753
96894
  if (type === 'market') {
96754
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() allows limit orders only');
96895
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' createOrder() allows limit orders only');
96755
96896
  }
96756
96897
  const market = this.market(symbol);
96757
96898
  const request = {
@@ -96773,7 +96914,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96773
96914
  */
96774
96915
  const side = this.safeString(params, 'side');
96775
96916
  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"');
96917
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' cancelOrder() requires a side parameter, "buy" or "sell"');
96777
96918
  }
96778
96919
  params = this.omit(params, 'side');
96779
96920
  const method = 'privatePostMy' + this.capitalize(side) + 'Cancel';
@@ -96791,7 +96932,7 @@ class coinspot extends _abstract_coinspot_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96791
96932
  headers = {
96792
96933
  'Content-Type': 'application/json',
96793
96934
  '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),
96935
+ 'sign': this.hmac(this.encode(body), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__/* .sha512 */ .o),
96795
96936
  };
96796
96937
  }
96797
96938
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
@@ -104684,7 +104825,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
104684
104825
  //
104685
104826
  const timestamp = this.safeIntegerProduct(interest, 'timestamp', 0.001);
104686
104827
  const marketId = this.safeString(interest, 'symbol');
104687
- return {
104828
+ return this.safeOpenInterest({
104688
104829
  'symbol': this.safeSymbol(marketId, market),
104689
104830
  'baseVolume': this.safeNumber(interest, 'oi_value'),
104690
104831
  'quoteVolume': this.safeNumber(interest, 'oi_value_usd'),
@@ -104693,7 +104834,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
104693
104834
  'timestamp': timestamp,
104694
104835
  'datetime': this.iso8601(timestamp),
104695
104836
  'info': interest,
104696
- };
104837
+ }, market);
104697
104838
  }
104698
104839
  async fetchLeverage(symbol, params = {}) {
104699
104840
  /**
@@ -105471,7 +105612,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
105471
105612
  const defaultCode = this.safeValue(this.options, 'code', 'BTC');
105472
105613
  const options = this.safeValue(this.options, methodName, {});
105473
105614
  const code = this.safeValue(options, 'code', defaultCode);
105474
- return this.safeValue2(params, 'code', code);
105615
+ return this.safeValue(params, 'code', code);
105475
105616
  }
105476
105617
  async fetchStatus(params = {}) {
105477
105618
  /**
@@ -135484,10 +135625,9 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135484
135625
  const data = this.safeValue(response, 'data', []);
135485
135626
  const openInterest = this.parseOpenInterest(data[0], market);
135486
135627
  const timestamp = this.safeInteger(response, 'ts');
135487
- return this.extend(openInterest, {
135488
- 'timestamp': timestamp,
135489
- 'datetime': this.iso8601(timestamp),
135490
- });
135628
+ openInterest['timestamp'] = timestamp;
135629
+ openInterest['datetime'] = this.iso8601(timestamp);
135630
+ return openInterest;
135491
135631
  }
135492
135632
  parseOpenInterest(interest, market = undefined) {
135493
135633
  //
@@ -135545,7 +135685,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135545
135685
  const timestamp = this.safeInteger(interest, 'ts');
135546
135686
  const amount = this.safeNumber(interest, 'volume');
135547
135687
  const value = this.safeNumber(interest, 'value');
135548
- return {
135688
+ return this.safeOpenInterest({
135549
135689
  'symbol': this.safeString(market, 'symbol'),
135550
135690
  'baseVolume': amount,
135551
135691
  'quoteVolume': value,
@@ -135554,7 +135694,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
135554
135694
  'timestamp': timestamp,
135555
135695
  'datetime': this.iso8601(timestamp),
135556
135696
  'info': interest,
135557
- };
135697
+ }, market);
135558
135698
  }
135559
135699
  async borrowMargin(code, amount, symbol = undefined, params = {}) {
135560
135700
  /**
@@ -178266,7 +178406,6 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
178266
178406
  for (let i = 0; i < types.length; i++) {
178267
178407
  promises.push(this.fetchMarketsByType(types[i], params));
178268
178408
  }
178269
- // why not both ¯\_(ツ)_/¯
178270
178409
  promises = await Promise.all(promises);
178271
178410
  for (let i = 0; i < promises.length; i++) {
178272
178411
  result = this.arrayConcat(result, promises[i]);
@@ -178400,6 +178539,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
178400
178539
  'expiryDatetime': this.iso8601(expiry),
178401
178540
  'strike': strikePrice,
178402
178541
  'optionType': optionType,
178542
+ 'created': this.safeInteger(market, 'listTime'),
178403
178543
  'precision': {
178404
178544
  'amount': this.safeNumber(market, 'lotSz'),
178405
178545
  'price': this.parseNumber(tickSize),
@@ -183586,7 +183726,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183586
183726
  openInterestAmount = this.safeNumber(interest, 'oi');
183587
183727
  openInterestValue = this.safeNumber(interest, 'oiCcy');
183588
183728
  }
183589
- return {
183729
+ return this.safeOpenInterest({
183590
183730
  'symbol': this.safeSymbol(id),
183591
183731
  'baseVolume': baseVolume,
183592
183732
  'quoteVolume': quoteVolume,
@@ -183595,7 +183735,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183595
183735
  'timestamp': timestamp,
183596
183736
  'datetime': this.iso8601(timestamp),
183597
183737
  'info': interest,
183598
- };
183738
+ }, market);
183599
183739
  }
183600
183740
  setSandboxMode(enable) {
183601
183741
  super.setSandboxMode(enable);
@@ -195037,14 +195177,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195037
195177
  * @param {object} [params] extra parameters specific to the binance api endpoint
195038
195178
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
195039
195179
  */
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
195180
  await this.loadMarkets();
195047
- symbols = this.marketSymbols(symbols);
195181
+ symbols = this.marketSymbols(symbols, undefined, false, true, true);
195048
195182
  const firstMarket = this.market(symbols[0]);
195049
195183
  let type = firstMarket['type'];
195050
195184
  if (firstMarket['contract']) {
@@ -195307,7 +195441,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195307
195441
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
195308
195442
  */
195309
195443
  await this.loadMarkets();
195310
- symbols = this.marketSymbols(symbols);
195444
+ symbols = this.marketSymbols(symbols, undefined, false, true, true);
195311
195445
  const options = this.safeValue(this.options, 'watchTradesForSymbols', {});
195312
195446
  const name = this.safeString(options, 'name', 'trade');
195313
195447
  const firstMarket = this.market(symbols[0]);
@@ -195782,7 +195916,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195782
195916
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
195783
195917
  */
195784
195918
  await this.loadMarkets();
195785
- symbols = this.marketSymbols(symbols);
195919
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
195786
195920
  const marketIds = this.marketIds(symbols);
195787
195921
  let market = undefined;
195788
195922
  let type = undefined;
@@ -233764,10 +233898,10 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
233764
233898
  },
233765
233899
  'urls': {
233766
233900
  'test': {
233767
- 'ws': 'wss://testnet.phemex.com/ws',
233901
+ 'ws': 'wss://testnet-api.phemex.com/ws',
233768
233902
  },
233769
233903
  'api': {
233770
- 'ws': 'wss://phemex.com/ws',
233904
+ 'ws': 'wss://ws.phemex.com',
233771
233905
  },
233772
233906
  },
233773
233907
  'options': {
@@ -262272,13 +262406,14 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262272
262406
  // "stockPrec": "3", // Stock currency precision
262273
262407
  // "moneyPrec": "2", // Precision of money currency
262274
262408
  // "feePrec": "4", // Fee precision
262275
- // "makerFee": "0.001", // Default maker fee ratio
262276
- // "takerFee": "0.001", // Default taker fee ratio
262409
+ // "makerFee": "0.1", // Default maker fee ratio
262410
+ // "takerFee": "0.1", // Default taker fee ratio
262277
262411
  // "minAmount": "0.001", // Minimal amount of stock to trade
262278
262412
  // "minTotal": "0.001", // Minimal amount of money to trade
262279
262413
  // "tradesEnabled": true, // Is trading enabled
262280
262414
  // "isCollateral": true, // Is margin trading enabled
262281
- // "type": "spot" // Market type. Possible values: "spot", "futures"
262415
+ // "type": "spot", // Market type. Possible values: "spot", "futures"
262416
+ // "maxTotal": "1000000000" // Maximum total(amount * price) of money to trade
262282
262417
  // },
262283
262418
  // {
262284
262419
  // ...
@@ -262320,6 +262455,10 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262320
262455
  else {
262321
262456
  type = 'spot';
262322
262457
  }
262458
+ const takerFeeRate = this.safeString(market, 'takerFee');
262459
+ const taker = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(takerFeeRate, '100');
262460
+ const makerFeeRate = this.safeString(market, 'makerFee');
262461
+ const maker = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(makerFeeRate, '100');
262323
262462
  const entry = {
262324
262463
  'id': id,
262325
262464
  'symbol': symbol,
@@ -262339,8 +262478,8 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262339
262478
  'contract': contract,
262340
262479
  'linear': linear,
262341
262480
  'inverse': inverse,
262342
- 'taker': this.safeNumber(market, 'makerFee'),
262343
- 'maker': this.safeNumber(market, 'takerFee'),
262481
+ 'taker': this.parseNumber(taker),
262482
+ 'maker': this.parseNumber(maker),
262344
262483
  'contractSize': contractSize,
262345
262484
  'expiry': undefined,
262346
262485
  'expiryDatetime': undefined,
@@ -262365,7 +262504,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262365
262504
  },
262366
262505
  'cost': {
262367
262506
  'min': this.safeNumber(market, 'minTotal'),
262368
- 'max': undefined,
262507
+ 'max': this.safeNumber(market, 'maxTotal'),
262369
262508
  },
262370
262509
  },
262371
262510
  'info': market,
@@ -262809,6 +262948,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262809
262948
  /**
262810
262949
  * @method
262811
262950
  * @name whitebit#fetchOrderBook
262951
+ * @see https://whitebit-exchange.github.io/api-docs/public/http-v4/#orderbook
262812
262952
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
262813
262953
  * @param {string} symbol unified symbol of the market to fetch the order book for
262814
262954
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -262821,7 +262961,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262821
262961
  'market': market['id'],
262822
262962
  };
262823
262963
  if (limit !== undefined) {
262824
- request['depth'] = limit; // default = 50, maximum = 100
262964
+ request['limit'] = limit; // default = 100, maximum = 100
262825
262965
  }
262826
262966
  const response = await this.v4PublicGetOrderbookMarket(this.extend(request, params));
262827
262967
  //
@@ -262843,7 +262983,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
262843
262983
  // ]
262844
262984
  // }
262845
262985
  //
262846
- const timestamp = this.parseToInt(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(this.safeString(response, 'timestamp'), '1000'));
262986
+ const timestamp = this.safeIntegerProduct(response, 'timestamp', 1000);
262847
262987
  return this.parseOrderBook(response, symbol, timestamp);
262848
262988
  }
262849
262989
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -263055,10 +263195,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
263055
263195
  }
263056
263196
  limit = Math.min(limit, maxLimit);
263057
263197
  const start = this.parseToInt(since / 1000);
263058
- const duration = this.parseTimeframe(timeframe);
263059
- const end = this.sum(start, duration * limit);
263060
263198
  request['start'] = start;
263061
- request['end'] = end;
263062
263199
  }
263063
263200
  if (limit !== undefined) {
263064
263201
  request['limit'] = Math.min(limit, 1440);
@@ -276418,7 +276555,7 @@ SOFTWARE.
276418
276555
 
276419
276556
  //-----------------------------------------------------------------------------
276420
276557
  // this is updated by vss.js when building
276421
- const version = '4.1.10';
276558
+ const version = '4.1.11';
276422
276559
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
276423
276560
  //-----------------------------------------------------------------------------
276424
276561