ccxt 4.1.30 → 4.1.32

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/CHANGELOG.md +186 -0
  2. package/README.md +3 -3
  3. package/dist/ccxt.browser.js +428 -174
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/ascendex.js +89 -12
  7. package/dist/cjs/src/base/Exchange.js +6 -0
  8. package/dist/cjs/src/bitget.js +43 -27
  9. package/dist/cjs/src/bitvavo.js +43 -7
  10. package/dist/cjs/src/bybit.js +0 -3
  11. package/dist/cjs/src/coinex.js +2 -1
  12. package/dist/cjs/src/gemini.js +1 -2
  13. package/dist/cjs/src/hitbtc.js +32 -22
  14. package/dist/cjs/src/huobi.js +18 -12
  15. package/dist/cjs/src/krakenfutures.js +1 -0
  16. package/dist/cjs/src/mexc.js +2 -6
  17. package/dist/cjs/src/okx.js +1 -0
  18. package/dist/cjs/src/phemex.js +8 -6
  19. package/dist/cjs/src/pro/bittrex.js +68 -2
  20. package/dist/cjs/src/pro/huobi.js +76 -32
  21. package/dist/cjs/src/woo.js +27 -31
  22. package/js/ccxt.d.ts +3 -3
  23. package/js/ccxt.js +1 -1
  24. package/js/src/ascendex.d.ts +11 -1
  25. package/js/src/ascendex.js +89 -12
  26. package/js/src/base/Exchange.d.ts +5 -3
  27. package/js/src/base/Exchange.js +6 -0
  28. package/js/src/base/types.d.ts +9 -0
  29. package/js/src/binance.d.ts +1 -1
  30. package/js/src/bitget.d.ts +3 -3
  31. package/js/src/bitget.js +43 -27
  32. package/js/src/bitvavo.d.ts +13 -13
  33. package/js/src/bitvavo.js +43 -7
  34. package/js/src/bybit.js +0 -3
  35. package/js/src/coinex.d.ts +2 -2
  36. package/js/src/coinex.js +2 -1
  37. package/js/src/gate.d.ts +3 -3
  38. package/js/src/gemini.js +1 -2
  39. package/js/src/hitbtc.js +33 -23
  40. package/js/src/huobi.d.ts +1 -1
  41. package/js/src/huobi.js +18 -12
  42. package/js/src/krakenfutures.js +1 -0
  43. package/js/src/kucoinfutures.d.ts +2 -2
  44. package/js/src/mexc.d.ts +2 -2
  45. package/js/src/mexc.js +2 -6
  46. package/js/src/okx.d.ts +2 -2
  47. package/js/src/okx.js +1 -0
  48. package/js/src/phemex.d.ts +2 -2
  49. package/js/src/phemex.js +8 -6
  50. package/js/src/poloniexfutures.d.ts +2 -2
  51. package/js/src/pro/bittrex.d.ts +1 -0
  52. package/js/src/pro/bittrex.js +69 -3
  53. package/js/src/pro/huobi.js +76 -32
  54. package/js/src/woo.d.ts +1 -1
  55. package/js/src/woo.js +27 -31
  56. package/package.json +2 -2
@@ -3410,7 +3410,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
3410
3410
  'spot': true,
3411
3411
  'margin': true,
3412
3412
  'swap': true,
3413
- 'future': true,
3413
+ 'future': false,
3414
3414
  'option': false,
3415
3415
  'addMargin': true,
3416
3416
  'cancelAllOrders': true,
@@ -3432,7 +3432,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
3432
3432
  'fetchDepositsWithdrawals': true,
3433
3433
  'fetchDepositWithdrawFee': 'emulated',
3434
3434
  'fetchDepositWithdrawFees': true,
3435
- 'fetchFundingHistory': false,
3435
+ 'fetchFundingHistory': true,
3436
3436
  'fetchFundingRate': 'emulated',
3437
3437
  'fetchFundingRateHistory': false,
3438
3438
  'fetchFundingRates': true,
@@ -3646,7 +3646,6 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
3646
3646
  'accountsByType': {
3647
3647
  'spot': 'cash',
3648
3648
  'swap': 'futures',
3649
- 'future': 'futures',
3650
3649
  'margin': 'margin',
3651
3650
  },
3652
3651
  'transfer': {
@@ -6144,22 +6143,21 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6144
6143
  * @method
6145
6144
  * @name ascendex#setLeverage
6146
6145
  * @description set the level of leverage for a market
6146
+ * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage
6147
6147
  * @param {float} leverage the rate of leverage
6148
6148
  * @param {string} symbol unified market symbol
6149
6149
  * @param {object} [params] extra parameters specific to the ascendex api endpoint
6150
6150
  * @returns {object} response from the exchange
6151
6151
  */
6152
- if (symbol === undefined) {
6153
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
6154
- }
6152
+ this.checkRequiredSymbol('setLeverage', symbol);
6155
6153
  if ((leverage < 1) || (leverage > 100)) {
6156
6154
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' leverage should be between 1 and 100');
6157
6155
  }
6158
6156
  await this.loadMarkets();
6159
6157
  await this.loadAccounts();
6160
6158
  const market = this.market(symbol);
6161
- if (market['type'] !== 'future') {
6162
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' setLeverage() supports futures contracts only');
6159
+ if (!market['swap']) {
6160
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' setLeverage() supports swap contracts only');
6163
6161
  }
6164
6162
  const account = this.safeValue(this.accounts, 0, {});
6165
6163
  const accountGroup = this.safeString(account, 'id');
@@ -6175,11 +6173,13 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6175
6173
  * @method
6176
6174
  * @name ascendex#setMarginMode
6177
6175
  * @description set margin mode to 'cross' or 'isolated'
6176
+ * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type
6178
6177
  * @param {string} marginMode 'cross' or 'isolated'
6179
6178
  * @param {string} symbol unified market symbol
6180
6179
  * @param {object} [params] extra parameters specific to the ascendex api endpoint
6181
6180
  * @returns {object} response from the exchange
6182
6181
  */
6182
+ this.checkRequiredSymbol('setMarginMode', symbol);
6183
6183
  marginMode = marginMode.toLowerCase();
6184
6184
  if (marginMode === 'cross') {
6185
6185
  marginMode = 'crossed';
@@ -6195,10 +6195,10 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6195
6195
  const request = {
6196
6196
  'account-group': accountGroup,
6197
6197
  'symbol': market['id'],
6198
- 'marginMode': marginMode,
6198
+ 'marginType': marginMode,
6199
6199
  };
6200
- if (market['type'] !== 'future') {
6201
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' setMarginMode() supports futures contracts only');
6200
+ if (!market['swap']) {
6201
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' setMarginMode() supports swap contracts only');
6202
6202
  }
6203
6203
  return await this.v2PrivateAccountGroupPostFuturesMarginType(this.extend(request, params));
6204
6204
  }
@@ -6379,7 +6379,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6379
6379
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
6380
6380
  const toId = this.safeString(accountsByType, toAccount, toAccount);
6381
6381
  if (fromId !== 'cash' && toId !== 'cash') {
6382
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' transfer() only supports direct balance transfer between spot and future, spot and margin');
6382
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' transfer() only supports direct balance transfer between spot and swap, spot and margin');
6383
6383
  }
6384
6384
  const request = {
6385
6385
  'account-group': accountGroup,
@@ -6428,6 +6428,83 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6428
6428
  }
6429
6429
  return 'failed';
6430
6430
  }
6431
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6432
+ /**
6433
+ * @method
6434
+ * @name ascendex#fetchFundingHistory
6435
+ * @description fetch the history of funding payments paid and received on this account
6436
+ * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#funding-payment-history
6437
+ * @param {string} [symbol] unified market symbol
6438
+ * @param {int} [since] the earliest time in ms to fetch funding history for
6439
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
6440
+ * @param {object} [params] extra parameters specific to the ascendex api endpoint
6441
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6442
+ * @returns {object} a [funding history structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-history-structure}
6443
+ */
6444
+ await this.loadMarkets();
6445
+ await this.loadAccounts();
6446
+ let paginate = false;
6447
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
6448
+ if (paginate) {
6449
+ return await this.fetchPaginatedCallIncremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25);
6450
+ }
6451
+ const account = this.safeValue(this.accounts, 0, {});
6452
+ const accountGroup = this.safeString(account, 'id');
6453
+ const request = {
6454
+ 'account-group': accountGroup,
6455
+ };
6456
+ let market = undefined;
6457
+ if (symbol !== undefined) {
6458
+ market = this.market(symbol);
6459
+ request['symbol'] = market['id'];
6460
+ }
6461
+ if (limit !== undefined) {
6462
+ request['pageSize'] = limit;
6463
+ }
6464
+ const response = await this.v2PrivateAccountGroupGetFuturesFundingPayments(this.extend(request, params));
6465
+ //
6466
+ // {
6467
+ // "code": 0,
6468
+ // "data": {
6469
+ // "data": [
6470
+ // {
6471
+ // "timestamp": 1640476800000,
6472
+ // "symbol": "BTC-PERP",
6473
+ // "paymentInUSDT": "-0.013991178",
6474
+ // "fundingRate": "0.000173497"
6475
+ // },
6476
+ // ],
6477
+ // "page": 1,
6478
+ // "pageSize": 3,
6479
+ // "hasNext": true
6480
+ // }
6481
+ // }
6482
+ //
6483
+ const data = this.safeValue(response, 'data', {});
6484
+ const rows = this.safeValue(data, 'data', []);
6485
+ return this.parseIncomes(rows, market, since, limit);
6486
+ }
6487
+ parseIncome(income, market = undefined) {
6488
+ //
6489
+ // {
6490
+ // "timestamp": 1640476800000,
6491
+ // "symbol": "BTC-PERP",
6492
+ // "paymentInUSDT": "-0.013991178",
6493
+ // "fundingRate": "0.000173497"
6494
+ // }
6495
+ //
6496
+ const marketId = this.safeString(income, 'symbol');
6497
+ const timestamp = this.safeInteger(income, 'timestamp');
6498
+ return {
6499
+ 'info': income,
6500
+ 'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
6501
+ 'code': 'USDT',
6502
+ 'timestamp': timestamp,
6503
+ 'datetime': this.iso8601(timestamp),
6504
+ 'id': undefined,
6505
+ 'amount': this.safeNumber(income, 'paymentInUSDT'),
6506
+ };
6507
+ }
6431
6508
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
6432
6509
  const version = api[0];
6433
6510
  const access = api[1];
@@ -6597,6 +6674,7 @@ class Exchange {
6597
6674
  this.last_http_response = undefined;
6598
6675
  this.last_json_response = undefined;
6599
6676
  this.last_response_headers = undefined;
6677
+ this.last_request_headers = undefined;
6600
6678
  this.id = undefined;
6601
6679
  this.markets = undefined;
6602
6680
  this.status = undefined;
@@ -6791,6 +6869,7 @@ class Exchange {
6791
6869
  this.last_http_response = undefined;
6792
6870
  this.last_json_response = undefined;
6793
6871
  this.last_response_headers = undefined;
6872
+ this.last_request_headers = undefined;
6794
6873
  // camelCase and snake_notation support
6795
6874
  const unCamelCaseProperties = (obj = this) => {
6796
6875
  if (obj !== null) {
@@ -9357,6 +9436,7 @@ class Exchange {
9357
9436
  }
9358
9437
  this.lastRestRequestTimestamp = this.milliseconds();
9359
9438
  const request = this.sign(path, api, method, params, headers, body);
9439
+ this.last_request_headers = request['headers'];
9360
9440
  return await this.fetch(request['url'], request['method'], request['headers'], request['body']);
9361
9441
  }
9362
9442
  async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
@@ -9941,6 +10021,9 @@ class Exchange {
9941
10021
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9942
10022
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingRateHistory() is not supported yet');
9943
10023
  }
10024
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
10025
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingHistory() is not supported yet');
10026
+ }
9944
10027
  parseLastPrice(price, market = undefined) {
9945
10028
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseLastPrice() is not supported yet');
9946
10029
  }
@@ -40105,11 +40188,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40105
40188
  };
40106
40189
  }
40107
40190
  async fetchMarketsByType(type, params = {}) {
40108
- const method = this.getSupportedMapping(type, {
40109
- 'spot': 'publicSpotGetPublicProducts',
40110
- 'swap': 'publicMixGetMarketContracts',
40111
- });
40112
- const response = await this[method](params);
40191
+ let response = undefined;
40192
+ if (type === 'spot') {
40193
+ response = await this.publicSpotGetPublicProducts(params);
40194
+ }
40195
+ else if (type === 'swap') {
40196
+ response = await this.publicMixGetMarketContracts(params);
40197
+ }
40198
+ else {
40199
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' does not support ' + type + ' market');
40200
+ }
40113
40201
  //
40114
40202
  // spot
40115
40203
  //
@@ -42367,11 +42455,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42367
42455
  if (!isStopOrder && !isTriggerOrder) {
42368
42456
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' editOrder() only support plan orders');
42369
42457
  }
42370
- let method = this.getSupportedMapping(marketType, {
42371
- 'spot': 'privateSpotPostPlanModifyPlan',
42372
- 'swap': 'privateMixPostPlanModifyPlan',
42373
- 'future': 'privateMixPostPlanModifyPlan',
42374
- });
42375
42458
  if (triggerPrice !== undefined) {
42376
42459
  // default triggerType to market price for unification
42377
42460
  const triggerType = this.safeString(params, 'triggerType', 'market_price');
@@ -42379,6 +42462,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42379
42462
  request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
42380
42463
  request['executePrice'] = this.priceToPrecision(symbol, price);
42381
42464
  }
42465
+ const omitted = this.omit(query, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice']);
42466
+ let response = undefined;
42382
42467
  if (marketType === 'spot') {
42383
42468
  if (isStopOrder) {
42384
42469
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' editOrder() does not support stop orders on spot markets, only swap markets');
@@ -42398,10 +42483,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42398
42483
  else {
42399
42484
  request['size'] = this.amountToPrecision(symbol, amount);
42400
42485
  }
42486
+ response = await this.privateSpotPostPlanModifyPlan(this.extend(request, omitted));
42401
42487
  }
42402
42488
  else {
42403
42489
  request['symbol'] = market['id'];
42404
42490
  request['size'] = this.amountToPrecision(symbol, amount);
42491
+ if ((marketType !== 'swap') && (marketType !== 'future')) {
42492
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' editOrder() does not support ' + marketType + ' market');
42493
+ }
42494
+ request['marginCoin'] = market['settleId'];
42405
42495
  if (isStopOrder) {
42406
42496
  if (!isMarketOrder) {
42407
42497
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' editOrder() bitget stopLoss or takeProfit orders must be market orders');
@@ -42414,12 +42504,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42414
42504
  request['triggerPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
42415
42505
  request['planType'] = 'profit_plan';
42416
42506
  }
42417
- method = 'privateMixPostPlanModifyTPSLPlan';
42507
+ response = await this.privateMixPostPlanModifyTPSLPlan(this.extend(request, omitted));
42508
+ }
42509
+ else {
42510
+ response = await this.privateMixPostPlanModifyPlan(this.extend(request, omitted));
42418
42511
  }
42419
- request['marginCoin'] = market['settleId'];
42420
42512
  }
42421
- const omitted = this.omit(query, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice']);
42422
- const response = await this[method](this.extend(request, omitted));
42423
42513
  //
42424
42514
  // spot
42425
42515
  // {
@@ -42749,16 +42839,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42749
42839
  await this.loadMarkets();
42750
42840
  const market = this.market(symbol);
42751
42841
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
42752
- const method = this.getSupportedMapping(marketType, {
42753
- 'spot': 'privateSpotPostTradeOrderInfo',
42754
- 'swap': 'privateMixGetOrderDetail',
42755
- 'future': 'privateMixGetOrderDetail',
42756
- });
42757
42842
  const request = {
42758
42843
  'symbol': market['id'],
42759
42844
  'orderId': id,
42760
42845
  };
42761
- let response = await this[method](this.extend(request, query));
42846
+ let response = undefined;
42847
+ if (marketType === 'spot') {
42848
+ response = await this.privateSpotPostTradeOrderInfo(this.extend(request, query));
42849
+ }
42850
+ else if ((marketType === 'swap') || (marketType === 'future')) {
42851
+ response = await this.privateMixGetOrderDetail(this.extend(request, query));
42852
+ }
42853
+ else {
42854
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrder() does not support ' + marketType + ' market');
42855
+ }
42762
42856
  // spot
42763
42857
  // {
42764
42858
  // code: '00000',
@@ -43684,16 +43778,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43684
43778
  await this.loadMarkets();
43685
43779
  const market = this.market(symbol);
43686
43780
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrderTrades', market, params);
43687
- const method = this.getSupportedMapping(marketType, {
43688
- 'spot': 'privateSpotPostTradeFills',
43689
- 'swap': 'privateMixGetOrderFills',
43690
- 'future': 'privateMixGetOrderFills',
43691
- });
43692
43781
  const request = {
43693
43782
  'symbol': market['id'],
43694
43783
  'orderId': id,
43695
43784
  };
43696
- const response = await this[method](this.extend(request, query));
43785
+ let response = undefined;
43786
+ if (marketType === 'spot') {
43787
+ response = await this.privateSpotPostTradeFills(this.extend(request, query));
43788
+ }
43789
+ else if ((marketType === 'swap') || (marketType === 'future')) {
43790
+ response = await this.privateMixGetOrderFills(this.extend(request, query));
43791
+ }
43792
+ else {
43793
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrderTrades() does not support ' + marketType + ' market');
43794
+ }
43697
43795
  // spot
43698
43796
  //
43699
43797
  // swap
@@ -44157,7 +44255,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44157
44255
  'previousFundingDatetime': undefined,
44158
44256
  };
44159
44257
  }
44160
- async fetchFundingHistory(symbol, since = undefined, limit = undefined, params = {}) {
44258
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
44161
44259
  /**
44162
44260
  * @method
44163
44261
  * @name bitget#fetchFundingHistory
@@ -44170,6 +44268,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44170
44268
  * @returns {object[]} a list of [funding history structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-history-structure}
44171
44269
  */
44172
44270
  await this.loadMarkets();
44271
+ this.checkRequiredSymbol('fetchFundingHistory', symbol);
44173
44272
  const market = this.market(symbol);
44174
44273
  if (!market['swap']) {
44175
44274
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol(this.id + ' fetchFundingHistory() supports swap contracts only');
@@ -66575,6 +66674,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66575
66674
  /**
66576
66675
  * @method
66577
66676
  * @name bitvavo#fetchTicker
66677
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get
66578
66678
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
66579
66679
  * @param {string} symbol unified symbol of the market to fetch the ticker for
66580
66680
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
@@ -66688,16 +66788,24 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66688
66788
  /**
66689
66789
  * @method
66690
66790
  * @name bitvavo#fetchTrades
66791
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get
66691
66792
  * @description get the list of most recent trades for a particular symbol
66692
66793
  * @param {string} symbol unified symbol of the market to fetch trades for
66693
66794
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
66694
66795
  * @param {int} [limit] the maximum amount of trades to fetch
66695
66796
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
66797
+ * @param {int} [params.until] the latest time in ms to fetch entries for
66798
+ * @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)
66696
66799
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
66697
66800
  */
66698
66801
  await this.loadMarkets();
66699
66802
  const market = this.market(symbol);
66700
- const request = {
66803
+ let paginate = false;
66804
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
66805
+ if (paginate) {
66806
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
66807
+ }
66808
+ let request = {
66701
66809
  'market': market['id'],
66702
66810
  // 'limit': 500, // default 500, max 1000
66703
66811
  // 'start': since,
@@ -66711,6 +66819,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66711
66819
  if (since !== undefined) {
66712
66820
  request['start'] = since;
66713
66821
  }
66822
+ [request, params] = this.handleUntilOption('end', request, params);
66714
66823
  const response = await this.publicGetMarketTrades(this.extend(request, params));
66715
66824
  //
66716
66825
  // [
@@ -66861,6 +66970,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66861
66970
  /**
66862
66971
  * @method
66863
66972
  * @name bitvavo#fetchOrderBook
66973
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get
66864
66974
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
66865
66975
  * @param {string} symbol unified symbol of the market to fetch the order book for
66866
66976
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -66920,17 +67030,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66920
67030
  /**
66921
67031
  * @method
66922
67032
  * @name bitvavo#fetchOHLCV
67033
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
66923
67034
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
66924
67035
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
66925
67036
  * @param {string} timeframe the length of time each candle represents
66926
67037
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
66927
67038
  * @param {int} [limit] the maximum amount of candles to fetch
66928
67039
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
67040
+ * @param {int} [params.until] the latest time in ms to fetch entries for
67041
+ * @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)
66929
67042
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
66930
67043
  */
66931
67044
  await this.loadMarkets();
66932
67045
  const market = this.market(symbol);
66933
- const request = {
67046
+ let paginate = false;
67047
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
67048
+ if (paginate) {
67049
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
67050
+ }
67051
+ let request = {
66934
67052
  'market': market['id'],
66935
67053
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
66936
67054
  // 'limit': 1440, // default 1440, max 1440
@@ -66946,6 +67064,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66946
67064
  }
66947
67065
  request['end'] = this.sum(since, limit * duration * 1000);
66948
67066
  }
67067
+ [request, params] = this.handleUntilOption('end', request, params);
66949
67068
  if (limit !== undefined) {
66950
67069
  request['limit'] = limit; // default 1440, max 1440
66951
67070
  }
@@ -67299,19 +67418,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67299
67418
  /**
67300
67419
  * @method
67301
67420
  * @name bitvavo#fetchOrders
67421
+ * @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/get
67302
67422
  * @description fetches information on multiple orders made by the user
67303
67423
  * @param {string} symbol unified market symbol of the market orders were made in
67304
67424
  * @param {int} [since] the earliest time in ms to fetch orders for
67305
67425
  * @param {int} [limit] the maximum number of orde structures to retrieve
67306
67426
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
67427
+ * @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)
67428
+ * @param {int} [params.until] the latest time in ms to fetch entries for
67307
67429
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
67308
67430
  */
67309
- if (symbol === undefined) {
67310
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
67311
- }
67431
+ this.checkRequiredSymbol('fetchOrders', symbol);
67312
67432
  await this.loadMarkets();
67433
+ let paginate = false;
67434
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
67435
+ if (paginate) {
67436
+ return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
67437
+ }
67313
67438
  const market = this.market(symbol);
67314
- const request = {
67439
+ let request = {
67315
67440
  'market': market['id'],
67316
67441
  // 'limit': 500,
67317
67442
  // 'start': since,
@@ -67325,6 +67450,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67325
67450
  if (limit !== undefined) {
67326
67451
  request['limit'] = limit; // default 500, max 1000
67327
67452
  }
67453
+ [request, params] = this.handleUntilOption('end', request, params);
67328
67454
  const response = await this.privateGetOrders(this.extend(request, params));
67329
67455
  //
67330
67456
  // [
@@ -67549,19 +67675,27 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67549
67675
  /**
67550
67676
  * @method
67551
67677
  * @name bitvavo#fetchMyTrades
67678
+ * @see https://docs.bitvavo.com/#tag/Trades/paths/~1trades/get
67552
67679
  * @description fetch all trades made by the user
67553
67680
  * @param {string} symbol unified market symbol
67554
67681
  * @param {int} [since] the earliest time in ms to fetch trades for
67555
67682
  * @param {int} [limit] the maximum number of trades structures to retrieve
67556
67683
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
67684
+ * @param {int} [params.until] the latest time in ms to fetch entries for
67685
+ * @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)
67557
67686
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
67558
67687
  */
67559
67688
  if (symbol === undefined) {
67560
67689
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
67561
67690
  }
67562
67691
  await this.loadMarkets();
67692
+ let paginate = false;
67693
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
67694
+ if (paginate) {
67695
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
67696
+ }
67563
67697
  const market = this.market(symbol);
67564
- const request = {
67698
+ let request = {
67565
67699
  'market': market['id'],
67566
67700
  // 'limit': 500,
67567
67701
  // 'start': since,
@@ -67575,6 +67709,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67575
67709
  if (limit !== undefined) {
67576
67710
  request['limit'] = limit; // default 500, max 1000
67577
67711
  }
67712
+ [request, params] = this.handleUntilOption('end', request, params);
67578
67713
  const response = await this.privateGetTrades(this.extend(request, params));
67579
67714
  //
67580
67715
  // [
@@ -75102,9 +75237,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75102
75237
  'deposit': {},
75103
75238
  },
75104
75239
  },
75105
- 'commonCurrencies': {
75106
- 'GAS': 'GASDAO',
75107
- },
75108
75240
  });
75109
75241
  }
75110
75242
  nonce() {
@@ -90766,7 +90898,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
90766
90898
  const remainingString = this.safeString(order, 'left');
90767
90899
  const marketId = this.safeString(order, 'market');
90768
90900
  const defaultType = this.safeString(this.options, 'defaultType');
90769
- market = this.safeMarket(marketId, market, undefined, defaultType);
90901
+ const orderType = ('source' in order) ? 'swap' : defaultType;
90902
+ market = this.safeMarket(marketId, market, undefined, orderType);
90770
90903
  const feeCurrencyId = this.safeString(order, 'fee_asset');
90771
90904
  let feeCurrency = this.safeCurrencyCode(feeCurrencyId);
90772
90905
  if (feeCurrency === undefined) {
@@ -124750,11 +124883,10 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
124750
124883
  }
124751
124884
  for (let i = 0; i < marketIds.length; i++) {
124752
124885
  const marketId = marketIds[i];
124753
- const method = 'publicGetV1SymbolsDetailsSymbol';
124754
124886
  const request = {
124755
124887
  'symbol': marketId,
124756
124888
  };
124757
- promises.push(this[method](this.extend(request, params)));
124889
+ promises.push(this.publicGetV1SymbolsDetailsSymbol(this.extend(request, params)));
124758
124890
  //
124759
124891
  // {
124760
124892
  // "symbol": "BTCUSD",
@@ -126030,6 +126162,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
126030
126162
  'cancelOrder': true,
126031
126163
  'createDepositAddress': true,
126032
126164
  'createOrder': true,
126165
+ 'createPostOnlyOrder': true,
126033
126166
  'createReduceOnlyOrder': true,
126034
126167
  'createStopLimitOrder': true,
126035
126168
  'createStopMarketOrder': true,
@@ -128044,14 +128177,24 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
128044
128177
  * @param {float} amount how much of currency you want to trade in units of base currency
128045
128178
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
128046
128179
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
128047
- * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
128180
+ * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both
128048
128181
  * @param {bool} [params.margin] true for creating a margin order
128049
128182
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
128183
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
128184
+ * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", "Day", "GTD"
128050
128185
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
128051
128186
  */
128052
128187
  await this.loadMarkets();
128053
128188
  const market = this.market(symbol);
128054
128189
  const isLimit = (type === 'limit');
128190
+ const reduceOnly = this.safeValue(params, 'reduceOnly');
128191
+ const timeInForce = this.safeString(params, 'timeInForce');
128192
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
128193
+ let marketType = undefined;
128194
+ [marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
128195
+ let marginMode = undefined;
128196
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
128197
+ const isPostOnly = this.isPostOnly(type === 'market', undefined, params);
128055
128198
  const request = {
128056
128199
  'type': type,
128057
128200
  'side': side,
@@ -128069,7 +128212,6 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
128069
128212
  // 'take_rate': 0.001, // Optional
128070
128213
  // 'make_rate': 0.001, // Optional
128071
128214
  };
128072
- const reduceOnly = this.safeValue(params, 'reduceOnly');
128073
128215
  if (reduceOnly !== undefined) {
128074
128216
  if ((market['type'] !== 'swap') && (market['type'] !== 'margin')) {
128075
128217
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() does not support reduce_only for ' + market['type'] + ' orders, reduce_only orders are supported for swap and margin markets only');
@@ -128078,8 +128220,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
128078
128220
  if (reduceOnly === true) {
128079
128221
  request['reduce_only'] = reduceOnly;
128080
128222
  }
128081
- const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
128082
- const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
128223
+ if (isPostOnly) {
128224
+ request['post_only'] = true;
128225
+ }
128226
+ if (timeInForce !== undefined) {
128227
+ request['time_in_force'] = timeInForce;
128228
+ }
128083
128229
  if (isLimit || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
128084
128230
  if (price === undefined) {
128085
128231
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a price argument for limit orders');
@@ -128104,19 +128250,20 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
128104
128250
  else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
128105
128251
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
128106
128252
  }
128107
- let marketType = undefined;
128108
- [marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
128109
- let method = this.getSupportedMapping(marketType, {
128110
- 'spot': 'privatePostSpotOrder',
128111
- 'swap': 'privatePostFuturesOrder',
128112
- 'margin': 'privatePostMarginOrder',
128113
- });
128114
- const [marginMode, query] = this.handleMarginModeAndParams('createOrder', params);
128115
- if (marginMode !== undefined) {
128116
- method = 'privatePostMarginOrder';
128253
+ params = this.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly']);
128254
+ if ((marketType === 'swap') && (marginMode !== undefined)) {
128255
+ request['margin_mode'] = marginMode;
128256
+ }
128257
+ let response = undefined;
128258
+ if (marketType === 'swap') {
128259
+ response = await this.privatePostFuturesOrder(this.extend(request, params));
128260
+ }
128261
+ else if ((marketType === 'margin') || (marginMode !== undefined)) {
128262
+ response = await this.privatePostMarginOrder(this.extend(request, params));
128263
+ }
128264
+ else {
128265
+ response = await this.privatePostSpotOrder(this.extend(request, params));
128117
128266
  }
128118
- params = this.omit(params, ['triggerPrice', 'timeInForce', 'time_in_force', 'stopPrice', 'stop_price', 'reduceOnly']);
128119
- const response = await this[method](this.extend(request, query));
128120
128267
  return this.parseOrder(response, market);
128121
128268
  }
128122
128269
  parseOrderStatus(status) {
@@ -129039,12 +129186,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
129039
129186
  const isMargin = this.safeValue(params, 'margin', false);
129040
129187
  let marginMode = undefined;
129041
129188
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
129042
- if (marginMode !== undefined) {
129043
- if (marginMode !== 'isolated') {
129044
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' only isolated margin is supported');
129045
- }
129046
- }
129047
- else {
129189
+ if (marginMode === undefined) {
129048
129190
  if ((defaultType === 'margin') || (isMargin === true)) {
129049
129191
  marginMode = 'isolated';
129050
129192
  }
@@ -131920,6 +132062,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
131920
132062
  '1220': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AccountNotEnabled,
131921
132063
  '1303': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
131922
132064
  '1461': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
132065
+ '4007': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
131923
132066
  'bad-request': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
131924
132067
  'validation-format-error': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
131925
132068
  'validation-constraints-required': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
@@ -134062,6 +134205,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134062
134205
  /**
134063
134206
  * @method
134064
134207
  * @name huobi#fetchBalance
134208
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-account-balance-of-a-specific-account
134209
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec4b429-7773-11ed-9966-0242ac110003
134210
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=10000074-77b7-11ed-9966-0242ac110003
134211
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#query-asset-valuation
134212
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-user-s-account-information
134213
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-query-user-s-account-information
134214
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-query-user-39-s-account-information
134065
134215
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
134066
134216
  * @param {object} [params] extra parameters specific to the huobi api endpoint
134067
134217
  * @param {bool} [params.unified] provide this parameter if you have a recent account with unified cross+isolated margin account
@@ -134074,10 +134224,8 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134074
134224
  const isUnifiedAccount = this.safeValue2(params, 'isUnifiedAccount', 'unified', false);
134075
134225
  params = this.omit(params, ['isUnifiedAccount', 'unified']);
134076
134226
  const request = {};
134077
- let method = undefined;
134078
134227
  const spot = (type === 'spot');
134079
134228
  const future = (type === 'future');
134080
- const swap = (type === 'swap');
134081
134229
  const defaultSubType = this.safeString2(this.options, 'defaultSubType', 'subType', 'linear');
134082
134230
  let subType = this.safeString2(options, 'defaultSubType', 'subType', defaultSubType);
134083
134231
  subType = this.safeString2(params, 'defaultSubType', 'subType', subType);
@@ -134089,42 +134237,42 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134089
134237
  const isolated = (marginMode === 'isolated');
134090
134238
  const cross = (marginMode === 'cross');
134091
134239
  const margin = (type === 'margin') || (spot && (cross || isolated));
134240
+ let response = undefined;
134092
134241
  if (spot || margin) {
134093
134242
  if (margin) {
134094
134243
  if (isolated) {
134095
- method = 'spotPrivateGetV1MarginAccountsBalance';
134244
+ response = await this.spotPrivateGetV1MarginAccountsBalance(this.extend(request, params));
134096
134245
  }
134097
134246
  else {
134098
- method = 'spotPrivateGetV1CrossMarginAccountsBalance';
134247
+ response = await this.spotPrivateGetV1CrossMarginAccountsBalance(this.extend(request, params));
134099
134248
  }
134100
134249
  }
134101
134250
  else {
134102
134251
  await this.loadAccounts();
134103
134252
  const accountId = await this.fetchAccountIdByType(type, undefined, undefined, params);
134104
134253
  request['account-id'] = accountId;
134105
- method = 'spotPrivateGetV1AccountAccountsAccountIdBalance';
134254
+ response = await this.spotPrivateGetV1AccountAccountsAccountIdBalance(this.extend(request, params));
134106
134255
  }
134107
134256
  }
134108
134257
  else if (isUnifiedAccount) {
134109
- method = 'contractPrivateGetLinearSwapApiV3UnifiedAccountInfo';
134258
+ response = await this.contractPrivateGetLinearSwapApiV3UnifiedAccountInfo(this.extend(request, params));
134110
134259
  }
134111
134260
  else if (linear) {
134112
134261
  if (isolated) {
134113
- method = 'contractPrivatePostLinearSwapApiV1SwapAccountInfo';
134262
+ response = await this.contractPrivatePostLinearSwapApiV1SwapAccountInfo(this.extend(request, params));
134114
134263
  }
134115
134264
  else {
134116
- method = 'contractPrivatePostLinearSwapApiV1SwapCrossAccountInfo';
134265
+ response = await this.contractPrivatePostLinearSwapApiV1SwapCrossAccountInfo(this.extend(request, params));
134117
134266
  }
134118
134267
  }
134119
134268
  else if (inverse) {
134120
134269
  if (future) {
134121
- method = 'contractPrivatePostApiV1ContractAccountInfo';
134270
+ response = await this.contractPrivatePostApiV1ContractAccountInfo(this.extend(request, params));
134122
134271
  }
134123
- else if (swap) {
134124
- method = 'contractPrivatePostSwapApiV1SwapAccountInfo';
134272
+ else {
134273
+ response = await this.contractPrivatePostSwapApiV1SwapAccountInfo(this.extend(request, params));
134125
134274
  }
134126
134275
  }
134127
- const response = await this[method](this.extend(request, params));
134128
134276
  //
134129
134277
  // spot
134130
134278
  //
@@ -149971,6 +150119,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
149971
150119
  }
149972
150120
  const url = this.urls['api'][api] + query;
149973
150121
  if (api === 'private' || access === 'private') {
150122
+ this.checkRequiredCredentials();
149974
150123
  let auth = postData + '/api/';
149975
150124
  if (api !== 'private') {
149976
150125
  auth += api + '/';
@@ -166497,8 +166646,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166497
166646
  'spot': true,
166498
166647
  'margin': true,
166499
166648
  'swap': true,
166500
- 'future': true,
166501
- 'option': undefined,
166649
+ 'future': false,
166650
+ 'option': false,
166502
166651
  'addMargin': true,
166503
166652
  'borrowMargin': true,
166504
166653
  'cancelAllOrders': true,
@@ -166866,10 +167015,6 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166866
167015
  'fetchMarkets': {
166867
167016
  'types': {
166868
167017
  'spot': true,
166869
- 'future': {
166870
- 'linear': false,
166871
- 'inverse': false,
166872
- },
166873
167018
  'swap': {
166874
167019
  'linear': true,
166875
167020
  'inverse': false,
@@ -183102,6 +183247,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183102
183247
  parseOrderStatus(status) {
183103
183248
  const statuses = {
183104
183249
  'canceled': 'canceled',
183250
+ 'order_failed': 'canceled',
183105
183251
  'live': 'open',
183106
183252
  'partially_filled': 'open',
183107
183253
  'filled': 'closed',
@@ -191236,17 +191382,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
191236
191382
  // 'limit': 20, // Page size default 20, max 200
191237
191383
  // 'offset': 0, // Page start default 0
191238
191384
  };
191239
- if (limit > 200) {
191240
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchFundingHistory() limit argument cannot exceed 200');
191241
- }
191242
191385
  if (limit !== undefined) {
191386
+ if (limit > 200) {
191387
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchFundingHistory() limit argument cannot exceed 200');
191388
+ }
191243
191389
  request['limit'] = limit;
191244
191390
  }
191245
- let method = 'privateGetApiDataFuturesFundingFees';
191391
+ let response = undefined;
191246
191392
  if (market['settle'] === 'USDT') {
191247
- method = 'privateGetApiDataGFuturesFundingFees';
191393
+ response = await this.privateGetApiDataGFuturesFundingFees(this.extend(request, params));
191394
+ }
191395
+ else {
191396
+ response = await this.privateGetApiDataFuturesFundingFees(this.extend(request, params));
191248
191397
  }
191249
- const response = await this[method](this.extend(request, params));
191250
191398
  //
191251
191399
  // {
191252
191400
  // "code": 0,
@@ -209676,9 +209824,9 @@ class bitstamp extends _bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
209676
209824
  /* harmony export */ "Z": () => (/* binding */ bittrex)
209677
209825
  /* harmony export */ });
209678
209826
  /* harmony import */ var _bittrex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8963);
209679
- /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6689);
209680
- /* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3020);
209681
- /* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7110);
209827
+ /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
209828
+ /* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3020);
209829
+ /* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7110);
209682
209830
  /* harmony import */ var _static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7348);
209683
209831
  // ---------------------------------------------------------------------------
209684
209832
 
@@ -209725,6 +209873,12 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
209725
209873
  'maxRetries': 3,
209726
209874
  },
209727
209875
  },
209876
+ 'exceptions': {
209877
+ 'exact': {
209878
+ 'INVALID_APIKEY': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
209879
+ 'UNAUTHORIZED_USER': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
209880
+ },
209881
+ },
209728
209882
  });
209729
209883
  }
209730
209884
  getSignalRUrl(negotiation) {
@@ -209752,7 +209906,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
209752
209906
  const timestamp = this.milliseconds();
209753
209907
  const uuid = this.uuid();
209754
209908
  const auth = timestamp.toString() + uuid;
209755
- const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_2__/* .sha512 */ .o);
209909
+ const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__/* .sha512 */ .o);
209756
209910
  const args = [this.apiKey, timestamp, uuid, signature];
209757
209911
  const method = 'Authenticate';
209758
209912
  return this.makeRequest(requestId, method, args);
@@ -209775,6 +209929,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
209775
209929
  return await this.watch(url, messageHash, request, messageHash, subscription);
209776
209930
  }
209777
209931
  async authenticate(params = {}) {
209932
+ this.checkRequiredCredentials();
209778
209933
  await this.loadMarkets();
209779
209934
  const request = await this.negotiate();
209780
209935
  return await this.sendRequestToAuthenticate(request, false, params);
@@ -209795,7 +209950,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
209795
209950
  'negotiation': negotiation,
209796
209951
  'method': this.handleAuthenticate,
209797
209952
  };
209798
- this.spawn(this.watch, url, messageHash, request, requestId, subscription);
209953
+ this.watch(url, messageHash, request, requestId, subscription);
209799
209954
  }
209800
209955
  return await future;
209801
209956
  }
@@ -209930,7 +210085,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
209930
210085
  const parsed = this.parseOrder(delta);
209931
210086
  if (this.orders === undefined) {
209932
210087
  const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
209933
- this.orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCacheBySymbolById */ .hl(limit);
210088
+ this.orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheBySymbolById */ .hl(limit);
209934
210089
  }
209935
210090
  const orders = this.orders;
209936
210091
  orders.append(parsed);
@@ -210118,7 +210273,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210118
210273
  let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
210119
210274
  if (stored === undefined) {
210120
210275
  const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
210121
- stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCacheByTimestamp */ .Py(limit);
210276
+ stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheByTimestamp */ .Py(limit);
210122
210277
  this.ohlcvs[symbol][timeframe] = stored;
210123
210278
  }
210124
210279
  stored.append(parsed);
@@ -210181,7 +210336,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210181
210336
  let stored = this.safeValue(this.trades, symbol);
210182
210337
  if (stored === undefined) {
210183
210338
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
210184
- stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCache */ .ZL(limit);
210339
+ stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCache */ .ZL(limit);
210185
210340
  }
210186
210341
  const trades = this.parseTrades(deltas, market);
210187
210342
  for (let i = 0; i < trades.length; i++) {
@@ -210202,7 +210357,9 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210202
210357
  * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure
210203
210358
  */
210204
210359
  await this.loadMarkets();
210205
- symbol = this.symbol(symbol);
210360
+ if (symbol !== undefined) {
210361
+ symbol = this.symbol(symbol);
210362
+ }
210206
210363
  const authentication = await this.authenticate();
210207
210364
  const trades = await this.subscribeToMyTrades(authentication, params);
210208
210365
  if (this.newUpdates) {
@@ -210238,7 +210395,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210238
210395
  let stored = this.myTrades;
210239
210396
  if (stored === undefined) {
210240
210397
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
210241
- stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__/* .ArrayCacheBySymbolById */ .hl(limit);
210398
+ stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_4__/* .ArrayCacheBySymbolById */ .hl(limit);
210242
210399
  this.myTrades = stored;
210243
210400
  }
210244
210401
  for (let i = 0; i < trades.length; i++) {
@@ -210259,7 +210416,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210259
210416
  */
210260
210417
  limit = (limit === undefined) ? 25 : limit; // 25 by default
210261
210418
  if ((limit !== 1) && (limit !== 25) && (limit !== 500)) {
210262
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_4__.BadRequest(this.id + ' watchOrderBook() limit argument must be undefined, 1, 25 or 500, default is 25');
210419
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' watchOrderBook() limit argument must be undefined, 1, 25 or 500, default is 25');
210263
210420
  }
210264
210421
  await this.loadMarkets();
210265
210422
  symbol = this.symbol(symbol);
@@ -210322,7 +210479,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210322
210479
  }
210323
210480
  else {
210324
210481
  // throw upon failing to synchronize in maxAttempts
210325
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_4__.InvalidNonce(this.id + ' failed to synchronize WebSocket feed with the snapshot for symbol ' + symbol + ' in ' + maxAttempts.toString() + ' attempts');
210482
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidNonce(this.id + ' failed to synchronize WebSocket feed with the snapshot for symbol ' + symbol + ' in ' + maxAttempts.toString() + ' attempts');
210326
210483
  }
210327
210484
  }
210328
210485
  else {
@@ -210467,6 +210624,60 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210467
210624
  }
210468
210625
  return message;
210469
210626
  }
210627
+ handleErrorMessage(client, message) {
210628
+ //
210629
+ // {
210630
+ // R: [{ Success: false, ErrorCode: 'UNAUTHORIZED_USER' }, ... ],
210631
+ // I: '1698601759267'
210632
+ // }
210633
+ // {
210634
+ // R: { Success: false, ErrorCode: 'INVALID_APIKEY' },
210635
+ // I: '1698601759266'
210636
+ // }
210637
+ //
210638
+ const R = this.safeValue(message, 'R');
210639
+ if (R === undefined) {
210640
+ // Return there is no error
210641
+ return false;
210642
+ }
210643
+ const I = this.safeString(message, 'I');
210644
+ let errorCode = undefined;
210645
+ if (Array.isArray(R)) {
210646
+ for (let i = 0; i < R.length; i++) {
210647
+ const response = this.safeValue(R, i);
210648
+ const success = this.safeValue(response, 'Success', true);
210649
+ if (!success) {
210650
+ errorCode = this.safeString(response, 'ErrorCode');
210651
+ break;
210652
+ }
210653
+ }
210654
+ }
210655
+ else {
210656
+ const success = this.safeValue(R, 'Success', true);
210657
+ if (!success) {
210658
+ errorCode = this.safeString(R, 'ErrorCode');
210659
+ }
210660
+ }
210661
+ if (errorCode === undefined) {
210662
+ // Return there is no error
210663
+ return false;
210664
+ }
210665
+ const feedback = this.id + ' ' + errorCode;
210666
+ try {
210667
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
210668
+ if (message !== undefined) {
210669
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);
210670
+ }
210671
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(feedback);
210672
+ }
210673
+ catch (e) {
210674
+ if (e instanceof _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError) {
210675
+ client.reject(e, 'authenticate');
210676
+ }
210677
+ client.reject(e, I);
210678
+ }
210679
+ return true;
210680
+ }
210470
210681
  handleMessage(client, message) {
210471
210682
  //
210472
210683
  // subscription confirmation
@@ -210513,6 +210724,9 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
210513
210724
  // M: [ { H: 'C3', M: 'authenticationExpiring', A: [] } ]
210514
210725
  // }
210515
210726
  //
210727
+ if (this.handleErrorMessage(client, message)) {
210728
+ return;
210729
+ }
210516
210730
  const methods = {
210517
210731
  'authenticationExpiring': this.handleAuthenticationExpiring,
210518
210732
  'order': this.handleOrder,
@@ -224284,7 +224498,8 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
224284
224498
  '2021': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
224285
224499
  '2001': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol,
224286
224500
  '2011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol,
224287
- '2040': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest, // { op: 'sub', cid: '1649152947', 'err-code': 2040, 'err-msg': 'Missing required parameter.', ts: 1649152948684 }
224501
+ '2040': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
224502
+ '4007': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest, // { op: 'sub', cid: '1', topic: 'accounts_unify.USDT', 'err-code': 4007, 'err-msg': 'Non - single account user is not available, please check through the cross and isolated account asset interface', ts: 1698419318540 }
224288
224503
  },
224289
224504
  },
224290
224505
  },
@@ -225373,12 +225588,12 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225373
225588
  * @param {object} [params] extra parameters specific to the huobi api endpoint
225374
225589
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
225375
225590
  */
225376
- let type = this.safeString2(this.options, 'watchBalance', 'defaultType', 'spot');
225377
- type = this.safeString(params, 'type', type);
225378
- let subType = this.safeString2(this.options, 'watchBalance', 'subType', 'linear');
225379
- subType = this.safeString(params, 'subType', subType);
225380
- params = this.omit(params, ['type', 'subType']);
225381
- params = this.omit(params, 'type');
225591
+ let type = undefined;
225592
+ [type, params] = this.handleMarketTypeAndParams('watchBalance', undefined, params);
225593
+ let subType = undefined;
225594
+ [subType, params] = this.handleSubTypeAndParams('watchBalance', undefined, params, 'linear');
225595
+ const isUnifiedAccount = this.safeValue2(params, 'isUnifiedAccount', 'unified', false);
225596
+ params = this.omit(params, ['isUnifiedAccount', 'unified']);
225382
225597
  await this.loadMarkets();
225383
225598
  let messageHash = undefined;
225384
225599
  let channel = undefined;
@@ -225399,29 +225614,37 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225399
225614
  let prefix = 'accounts';
225400
225615
  messageHash = prefix;
225401
225616
  if (subType === 'linear') {
225402
- // usdt contracts account
225403
- prefix = (marginMode === 'cross') ? prefix + '_cross' : prefix;
225404
- messageHash = prefix;
225405
- if (marginMode === 'isolated') {
225406
- // isolated margin only allows filtering by symbol3
225407
- if (symbol !== undefined) {
225408
- messageHash += '.' + market['id'];
225409
- channel = messageHash;
225410
- }
225411
- else {
225412
- // subscribe to all
225413
- channel = prefix + '.' + '*';
225414
- }
225617
+ if (isUnifiedAccount) {
225618
+ // usdt contracts account
225619
+ prefix = 'accounts_unify';
225620
+ messageHash = prefix;
225621
+ channel = prefix + '.' + 'usdt';
225415
225622
  }
225416
225623
  else {
225417
- // cross margin
225418
- if (currencyCode !== undefined) {
225419
- channel = prefix + '.' + currencyCode['id'];
225420
- messageHash = channel;
225624
+ // usdt contracts account
225625
+ prefix = (marginMode === 'cross') ? prefix + '_cross' : prefix;
225626
+ messageHash = prefix;
225627
+ if (marginMode === 'isolated') {
225628
+ // isolated margin only allows filtering by symbol3
225629
+ if (symbol !== undefined) {
225630
+ messageHash += '.' + market['id'];
225631
+ channel = messageHash;
225632
+ }
225633
+ else {
225634
+ // subscribe to all
225635
+ channel = prefix + '.' + '*';
225636
+ }
225421
225637
  }
225422
225638
  else {
225423
- // subscribe to all
225424
- channel = prefix + '.' + '*';
225639
+ // cross margin
225640
+ if (currencyCode !== undefined) {
225641
+ channel = prefix + '.' + currencyCode['id'];
225642
+ messageHash = channel;
225643
+ }
225644
+ else {
225645
+ // subscribe to all
225646
+ channel = prefix + '.' + '*';
225647
+ }
225425
225648
  }
225426
225649
  }
225427
225650
  }
@@ -225599,7 +225822,9 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225599
225822
  return;
225600
225823
  }
225601
225824
  const first = this.safeValue(data, 0, {});
225602
- let messageHash = this.safeString(message, 'topic');
225825
+ const topic = this.safeString(message, 'topic');
225826
+ const splitTopic = topic.split('.');
225827
+ let messageHash = this.safeString(splitTopic, 0);
225603
225828
  let subscription = this.safeValue2(client.subscriptions, messageHash, messageHash + '.*');
225604
225829
  if (subscription === undefined) {
225605
225830
  // if subscription not found means that we subscribed to a specific currency/symbol
@@ -225607,13 +225832,37 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225607
225832
  // Example: topic = 'accounts'
225608
225833
  // client.subscription hash = 'accounts.usdt'
225609
225834
  // we do 'accounts' + '.' + data[0]]['margin_asset'] to get it
225610
- const marginAsset = this.safeString(first, 'margin_asset');
225611
- messageHash += '.' + marginAsset.toLowerCase();
225835
+ const currencyId = this.safeString2(first, 'margin_asset', 'symbol');
225836
+ messageHash += '.' + currencyId.toLowerCase();
225612
225837
  subscription = this.safeValue(client.subscriptions, messageHash);
225613
225838
  }
225614
225839
  const type = this.safeString(subscription, 'type');
225615
225840
  const subType = this.safeString(subscription, 'subType');
225616
- if (subType === 'linear') {
225841
+ if (topic === 'accounts_unify') {
225842
+ // {
225843
+ // margin_asset: 'USDT',
225844
+ // margin_static: 10,
225845
+ // cross_margin_static: 10,
225846
+ // margin_balance: 10,
225847
+ // cross_profit_unreal: 0,
225848
+ // margin_frozen: 0,
225849
+ // withdraw_available: 10,
225850
+ // cross_risk_rate: null,
225851
+ // cross_swap: [],
225852
+ // cross_future: [],
225853
+ // isolated_swap: []
225854
+ // }
225855
+ const marginAsset = this.safeString(first, 'margin_asset');
225856
+ const code = this.safeCurrencyCode(marginAsset);
225857
+ const marginFrozen = this.safeString(first, 'margin_frozen');
225858
+ const unifiedAccount = this.account();
225859
+ unifiedAccount['free'] = this.safeString(first, 'withdraw_available');
225860
+ unifiedAccount['used'] = marginFrozen;
225861
+ this.balance[code] = unifiedAccount;
225862
+ this.balance = this.safeBalance(this.balance);
225863
+ client.resolve(this.balance, 'accounts_unify');
225864
+ }
225865
+ else if (subType === 'linear') {
225617
225866
  const margin = this.safeString(subscription, 'margin');
225618
225867
  if (margin === 'cross') {
225619
225868
  const fieldName = (type === 'future') ? 'futures_contract_detail' : 'contract_detail';
@@ -225911,6 +226160,15 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225911
226160
  // id: '2'
225912
226161
  // }
225913
226162
  //
226163
+ // {
226164
+ // op: 'sub',
226165
+ // cid: '1',
226166
+ // topic: 'accounts_unify.USDT',
226167
+ // 'err-code': 4007,
226168
+ // 'err-msg': 'Non - single account user is not available, please check through the cross and isolated account asset interface',
226169
+ // ts: 1698419490189
226170
+ // }
226171
+ //
225914
226172
  const status = this.safeString(message, 'status');
225915
226173
  if (status === 'error') {
225916
226174
  const id = this.safeString(message, 'id');
@@ -225932,8 +226190,8 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
225932
226190
  }
225933
226191
  return false;
225934
226192
  }
225935
- const code = this.safeInteger(message, 'code');
225936
- if (code !== undefined && code !== 200) {
226193
+ const code = this.safeInteger2(message, 'code', 'err-code');
226194
+ if (code !== undefined && ((code !== 200) && (code !== 0))) {
225937
226195
  const feedback = this.id + ' ' + this.json(message);
225938
226196
  try {
225939
226197
  this.throwExactlyMatchedException(this.exceptions['ws']['exact'], code, feedback);
@@ -268384,29 +268642,27 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
268384
268642
  if (stopPrice !== undefined) {
268385
268643
  request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
268386
268644
  }
268645
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice']);
268387
268646
  const isStop = (stopPrice !== undefined) || (this.safeValue(params, 'childOrders') !== undefined);
268388
- let method = undefined;
268647
+ let response = undefined;
268389
268648
  if (isByClientOrder) {
268649
+ request['client_order_id'] = clientOrderIdExchangeSpecific;
268390
268650
  if (isStop) {
268391
- method = 'v3PrivatePutAlgoOrderClientClientOrderId';
268392
- request['oid'] = id;
268651
+ response = await this.v3PrivatePutAlgoOrderClientClientOrderId(this.extend(request, params));
268393
268652
  }
268394
268653
  else {
268395
- method = 'v3PrivatePutOrderClientClientOrderId';
268396
- request['client_order_id'] = clientOrderIdExchangeSpecific;
268654
+ response = await this.v3PrivatePutOrderClientClientOrderId(this.extend(request, params));
268397
268655
  }
268398
268656
  }
268399
268657
  else {
268658
+ request['oid'] = id;
268400
268659
  if (isStop) {
268401
- method = 'v3PrivatePutAlgoOrderOid';
268660
+ response = await this.v3PrivatePutAlgoOrderOid(this.extend(request, params));
268402
268661
  }
268403
268662
  else {
268404
- method = 'v3PrivatePutOrderOid';
268663
+ response = await this.v3PrivatePutOrderOid(this.extend(request, params));
268405
268664
  }
268406
- request['oid'] = id;
268407
268665
  }
268408
- params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice']);
268409
- const response = await this[method](this.extend(request, params));
268410
268666
  //
268411
268667
  // {
268412
268668
  // "code": 0,
@@ -268442,32 +268698,31 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
268442
268698
  this.checkRequiredSymbol('cancelOrder', symbol);
268443
268699
  }
268444
268700
  await this.loadMarkets();
268701
+ let market = undefined;
268702
+ if (symbol !== undefined) {
268703
+ market = this.market(symbol);
268704
+ }
268445
268705
  const request = {};
268446
268706
  const clientOrderIdUnified = this.safeString2(params, 'clOrdID', 'clientOrderId');
268447
268707
  const clientOrderIdExchangeSpecific = this.safeString(params, 'client_order_id', clientOrderIdUnified);
268448
268708
  const isByClientOrder = clientOrderIdExchangeSpecific !== undefined;
268449
- let method = undefined;
268709
+ let response = undefined;
268450
268710
  if (stop) {
268451
- method = 'v3PrivateDeleteAlgoOrderOrderId';
268452
268711
  request['order_id'] = id;
268453
- }
268454
- else if (isByClientOrder) {
268455
- method = 'v1PrivateDeleteClientOrder';
268456
- request['client_order_id'] = clientOrderIdExchangeSpecific;
268457
- params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
268712
+ response = await this.v3PrivateDeleteAlgoOrderOrderId(this.extend(request, params));
268458
268713
  }
268459
268714
  else {
268460
- method = 'v1PrivateDeleteOrder';
268461
- request['order_id'] = id;
268462
- }
268463
- let market = undefined;
268464
- if (symbol !== undefined) {
268465
- market = this.market(symbol);
268466
- }
268467
- if (!stop) {
268468
268715
  request['symbol'] = market['id'];
268716
+ if (isByClientOrder) {
268717
+ request['client_order_id'] = clientOrderIdExchangeSpecific;
268718
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
268719
+ response = await this.v1PrivateDeleteClientOrder(this.extend(request, params));
268720
+ }
268721
+ else {
268722
+ request['order_id'] = id;
268723
+ response = await this.v1PrivateDeleteOrder(this.extend(request, params));
268724
+ }
268469
268725
  }
268470
- const response = await this[method](this.extend(request, params));
268471
268726
  //
268472
268727
  // { success: true, status: 'CANCEL_SENT' }
268473
268728
  //
@@ -268531,20 +268786,19 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
268531
268786
  params = this.omit(params, 'stop');
268532
268787
  const request = {};
268533
268788
  const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
268534
- let method = undefined;
268789
+ let response = undefined;
268535
268790
  if (stop) {
268536
- method = 'v3PrivateGetAlgoOrderOid';
268537
268791
  request['oid'] = id;
268792
+ response = await this.v3PrivateGetAlgoOrderOid(this.extend(request, params));
268538
268793
  }
268539
268794
  else if (clientOrderId) {
268540
- method = 'v1PrivateGetClientOrderClientOrderId';
268541
268795
  request['client_order_id'] = clientOrderId;
268796
+ response = await this.v1PrivateGetClientOrderClientOrderId(this.extend(request, params));
268542
268797
  }
268543
268798
  else {
268544
- method = 'v1PrivateGetOrderOid';
268545
268799
  request['oid'] = id;
268800
+ response = await this.v1PrivateGetOrderOid(this.extend(request, params));
268546
268801
  }
268547
- const response = await this[method](this.extend(request, params));
268548
268802
  //
268549
268803
  // {
268550
268804
  // success: true,
@@ -279595,7 +279849,7 @@ SOFTWARE.
279595
279849
 
279596
279850
  //-----------------------------------------------------------------------------
279597
279851
  // this is updated by vss.js when building
279598
- const version = '4.1.30';
279852
+ const version = '4.1.32';
279599
279853
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
279600
279854
  //-----------------------------------------------------------------------------
279601
279855