ccxt 4.1.29 → 4.1.31

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 (61) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/README.md +3 -3
  3. package/dist/ccxt.browser.js +474 -135
  4. package/dist/ccxt.browser.min.js +2 -2
  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/base/ws/Future.js +6 -2
  9. package/dist/cjs/src/bitget.js +187 -44
  10. package/dist/cjs/src/bitopro.js +5 -4
  11. package/dist/cjs/src/bitrue.js +33 -18
  12. package/dist/cjs/src/bitvavo.js +43 -7
  13. package/dist/cjs/src/bybit.js +0 -3
  14. package/dist/cjs/src/coinex.js +2 -1
  15. package/dist/cjs/src/gate.js +58 -10
  16. package/dist/cjs/src/gemini.js +1 -2
  17. package/dist/cjs/src/hitbtc.js +32 -22
  18. package/dist/cjs/src/huobi.js +0 -1
  19. package/dist/cjs/src/huobijp.js +0 -1
  20. package/dist/cjs/src/krakenfutures.js +1 -1
  21. package/dist/cjs/src/mexc.js +2 -6
  22. package/dist/cjs/src/okx.js +1 -0
  23. package/dist/cjs/src/phemex.js +3 -0
  24. package/dist/cjs/src/pro/huobi.js +4 -0
  25. package/js/ccxt.d.ts +3 -3
  26. package/js/ccxt.js +1 -1
  27. package/js/src/ascendex.d.ts +11 -1
  28. package/js/src/ascendex.js +89 -12
  29. package/js/src/base/Exchange.d.ts +5 -3
  30. package/js/src/base/Exchange.js +6 -0
  31. package/js/src/base/types.d.ts +9 -0
  32. package/js/src/base/ws/Future.js +6 -2
  33. package/js/src/binance.d.ts +1 -1
  34. package/js/src/bitget.d.ts +3 -3
  35. package/js/src/bitget.js +187 -44
  36. package/js/src/bitopro.js +5 -4
  37. package/js/src/bitrue.js +33 -18
  38. package/js/src/bitvavo.d.ts +13 -13
  39. package/js/src/bitvavo.js +43 -7
  40. package/js/src/bybit.js +0 -3
  41. package/js/src/coinex.d.ts +2 -2
  42. package/js/src/coinex.js +2 -1
  43. package/js/src/gate.d.ts +3 -3
  44. package/js/src/gate.js +58 -10
  45. package/js/src/gemini.js +1 -2
  46. package/js/src/hitbtc.js +33 -23
  47. package/js/src/huobi.d.ts +1 -1
  48. package/js/src/huobi.js +0 -1
  49. package/js/src/huobijp.js +0 -1
  50. package/js/src/krakenfutures.js +1 -1
  51. package/js/src/kucoinfutures.d.ts +2 -2
  52. package/js/src/mexc.d.ts +2 -2
  53. package/js/src/mexc.js +2 -6
  54. package/js/src/okx.d.ts +2 -2
  55. package/js/src/okx.js +1 -0
  56. package/js/src/phemex.d.ts +2 -2
  57. package/js/src/phemex.js +3 -0
  58. package/js/src/poloniexfutures.d.ts +2 -2
  59. package/js/src/pro/huobi.js +4 -0
  60. package/js/src/woo.d.ts +1 -1
  61. 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
  }
@@ -13647,11 +13730,15 @@ function createFuture() {
13647
13730
  });
13648
13731
  p.resolve = function _resolve() {
13649
13732
  // eslint-disable-next-line prefer-rest-params
13650
- resolve.apply(this, arguments);
13733
+ setTimeout(() => {
13734
+ resolve.apply(this, arguments);
13735
+ });
13651
13736
  };
13652
13737
  p.reject = function _reject() {
13653
13738
  // eslint-disable-next-line prefer-rest-params
13654
- reject.apply(this, arguments);
13739
+ setTimeout(() => {
13740
+ reject.apply(this, arguments);
13741
+ });
13655
13742
  };
13656
13743
  return p;
13657
13744
  }
@@ -38823,7 +38910,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
38823
38910
  'has': {
38824
38911
  'CORS': undefined,
38825
38912
  'spot': true,
38826
- 'margin': undefined,
38913
+ 'margin': true,
38827
38914
  'swap': true,
38828
38915
  'future': true,
38829
38916
  'option': false,
@@ -40101,11 +40188,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40101
40188
  };
40102
40189
  }
40103
40190
  async fetchMarketsByType(type, params = {}) {
40104
- const method = this.getSupportedMapping(type, {
40105
- 'spot': 'publicSpotGetPublicProducts',
40106
- 'swap': 'publicMixGetMarketContracts',
40107
- });
40108
- 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
+ }
40109
40201
  //
40110
40202
  // spot
40111
40203
  //
@@ -40290,20 +40382,47 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40290
40382
  * @name bitget#fetchMarketLeverageTiers
40291
40383
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
40292
40384
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
40385
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-tier-data
40386
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-tier-data
40293
40387
  * @param {string} symbol unified market symbol
40294
40388
  * @param {object} [params] extra parameters specific to the bitget api endpoint
40389
+ * @param {string} [params.marginMode] for spot margin 'cross' or 'isolated', default is 'isolated'
40390
+ * @param {string} [params.code] required for cross spot margin
40295
40391
  * @returns {object} a [leverage tiers structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}
40296
40392
  */
40297
40393
  await this.loadMarkets();
40298
40394
  const request = {};
40299
- let market = undefined;
40300
- market = this.market(symbol);
40301
- if (market['spot']) {
40395
+ const market = this.market(symbol);
40396
+ let type = undefined;
40397
+ [type, params] = this.handleMarketTypeAndParams('fetchMarketLeverageTiers', market, params);
40398
+ let response = undefined;
40399
+ let marginMode = undefined;
40400
+ [marginMode, params] = this.handleMarginModeAndParams('fetchMarketLeverageTiers', params, 'isolated');
40401
+ if ((type === 'swap') || (type === 'future')) {
40402
+ const marketId = market['id'];
40403
+ const parts = marketId.split('_');
40404
+ const productType = this.safeStringUpper(parts, 1);
40405
+ request['symbol'] = marketId;
40406
+ request['productType'] = productType;
40407
+ response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
40408
+ }
40409
+ else if (marginMode === 'isolated') {
40410
+ request['symbol'] = market['info']['symbolName'];
40411
+ response = await this.publicMarginGetIsolatedPublicTierData(this.extend(request, params));
40412
+ }
40413
+ else if (marginMode === 'cross') {
40414
+ const code = this.safeString(params, 'code');
40415
+ this.checkRequiredArgument('fetchMarketLeverageTiers', code, 'code');
40416
+ params = this.omit(params, 'code');
40417
+ const currency = this.currency(code);
40418
+ request['coin'] = currency['code'];
40419
+ response = await this.publicMarginGetCrossPublicTierData(this.extend(request, params));
40420
+ }
40421
+ else {
40302
40422
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchMarketLeverageTiers() symbol does not support market ' + symbol);
40303
40423
  }
40304
- request['symbol'] = market['id'];
40305
- request['productType'] = 'UMCBL';
40306
- const response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
40424
+ //
40425
+ // swap and future
40307
40426
  //
40308
40427
  // {
40309
40428
  // "code":"00000",
@@ -40320,10 +40439,50 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40320
40439
  // "requestTime":1627292076687
40321
40440
  // }
40322
40441
  //
40323
- const result = this.safeValue(response, 'data');
40442
+ // isolated
40443
+ //
40444
+ // {
40445
+ // "code": "00000",
40446
+ // "msg": "success",
40447
+ // "requestTime": 1698352496622,
40448
+ // "data": [
40449
+ // {
40450
+ // "tier": "1",
40451
+ // "symbol": "BTCUSDT",
40452
+ // "leverage": "10",
40453
+ // "baseCoin": "BTC",
40454
+ // "quoteCoin": "USDT",
40455
+ // "baseMaxBorrowableAmount": "3",
40456
+ // "quoteMaxBorrowableAmount": "30000",
40457
+ // "maintainMarginRate": "0.05",
40458
+ // "initRate": "0.1111"
40459
+ // },
40460
+ // ]
40461
+ // }
40462
+ //
40463
+ // cross
40464
+ //
40465
+ // {
40466
+ // "code": "00000",
40467
+ // "msg": "success",
40468
+ // "requestTime": 1698352997077,
40469
+ // "data": [
40470
+ // {
40471
+ // "tier": "1",
40472
+ // "leverage": "3",
40473
+ // "coin": "BTC",
40474
+ // "maxBorrowableAmount": "26",
40475
+ // "maintainMarginRate": "0.1"
40476
+ // }
40477
+ // ]
40478
+ // }
40479
+ //
40480
+ const result = this.safeValue(response, 'data', []);
40324
40481
  return this.parseMarketLeverageTiers(result, market);
40325
40482
  }
40326
40483
  parseMarketLeverageTiers(info, market = undefined) {
40484
+ //
40485
+ // swap and future
40327
40486
  //
40328
40487
  // [
40329
40488
  // {
@@ -40333,22 +40492,57 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40333
40492
  // "leverage": 125,
40334
40493
  // "keepMarginRate": "0.004"
40335
40494
  // }
40336
- // ],
40495
+ // ]
40496
+ //
40497
+ // isolated
40498
+ //
40499
+ // [
40500
+ // {
40501
+ // "tier": "1",
40502
+ // "symbol": "BTCUSDT",
40503
+ // "leverage": "10",
40504
+ // "baseCoin": "BTC",
40505
+ // "quoteCoin": "USDT",
40506
+ // "baseMaxBorrowableAmount": "3",
40507
+ // "quoteMaxBorrowableAmount": "30000",
40508
+ // "maintainMarginRate": "0.05",
40509
+ // "initRate": "0.1111"
40510
+ // }
40511
+ // ]
40512
+ //
40513
+ // cross
40514
+ //
40515
+ // [
40516
+ // {
40517
+ // "tier": "1",
40518
+ // "leverage": "3",
40519
+ // "coin": "BTC",
40520
+ // "maxBorrowableAmount": "26",
40521
+ // "maintainMarginRate": "0.1"
40522
+ // }
40523
+ // ]
40337
40524
  //
40338
40525
  const tiers = [];
40526
+ let minNotional = 0;
40339
40527
  for (let i = 0; i < info.length; i++) {
40340
40528
  const item = info[i];
40341
- const minNotional = this.safeNumber(item, 'startUnit');
40342
- const maxNotional = this.safeNumber(item, 'endUnit');
40529
+ const minimumNotional = this.safeNumber(item, 'startUnit');
40530
+ if (minimumNotional !== undefined) {
40531
+ minNotional = minimumNotional;
40532
+ }
40533
+ const maxNotional = this.safeNumberN(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount']);
40534
+ const marginCurrency = this.safeString2(item, 'coin', 'baseCoin');
40535
+ const currencyId = (marginCurrency !== undefined) ? marginCurrency : market['base'];
40343
40536
  tiers.push({
40344
- 'tier': this.sum(i, 1),
40345
- 'currency': market['base'],
40537
+ 'tier': this.safeInteger2(item, 'level', 'tier'),
40538
+ 'currency': this.safeCurrencyCode(currencyId),
40346
40539
  'minNotional': minNotional,
40347
40540
  'maxNotional': maxNotional,
40348
- 'maintenanceMarginRate': this.safeNumber(item, 'keepMarginRate'),
40541
+ 'maintenanceMarginRate': this.safeNumber2(item, 'keepMarginRate', 'maintainMarginRate'),
40349
40542
  'maxLeverage': this.safeNumber(item, 'leverage'),
40350
40543
  'info': item,
40351
40544
  });
40545
+ minNotional = maxNotional;
40352
40546
  }
40353
40547
  return tiers;
40354
40548
  }
@@ -42130,12 +42324,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42130
42324
  * @description create a list of trade orders (all orders should be of the same symbol)
42131
42325
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#batch-order
42132
42326
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
42327
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
42328
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
42133
42329
  * @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
42330
+ * @param {object} [params] extra parameters specific to the api endpoint
42134
42331
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
42135
42332
  */
42136
42333
  await this.loadMarkets();
42137
42334
  const ordersRequests = [];
42138
42335
  let symbol = undefined;
42336
+ let marginMode = undefined;
42139
42337
  for (let i = 0; i < orders.length; i++) {
42140
42338
  const rawOrder = orders[i];
42141
42339
  const marketId = this.safeString(rawOrder, 'symbol');
@@ -42152,23 +42350,44 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42152
42350
  const amount = this.safeValue(rawOrder, 'amount');
42153
42351
  const price = this.safeValue(rawOrder, 'price');
42154
42352
  const orderParams = this.safeValue(rawOrder, 'params', {});
42353
+ const marginResult = this.handleMarginModeAndParams('createOrders', params);
42354
+ const currentMarginMode = marginResult[0];
42355
+ if (currentMarginMode !== undefined) {
42356
+ if (marginMode === undefined) {
42357
+ marginMode = currentMarginMode;
42358
+ }
42359
+ else {
42360
+ if (marginMode !== currentMarginMode) {
42361
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
42362
+ }
42363
+ }
42364
+ }
42155
42365
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
42156
42366
  ordersRequests.push(orderRequest);
42157
42367
  }
42158
42368
  const market = this.market(symbol);
42369
+ const symbolRequest = (marginMode !== undefined) ? (market['info']['symbolName']) : (market['id']);
42159
42370
  const request = {
42160
- 'symbol': market['id'],
42371
+ 'symbol': symbolRequest,
42161
42372
  };
42162
42373
  let response = undefined;
42163
42374
  if (market['spot']) {
42164
42375
  request['orderList'] = ordersRequests;
42165
- response = await this.privateSpotPostTradeBatchOrders(request);
42166
42376
  }
42167
- else {
42377
+ if ((market['swap']) || (market['future'])) {
42168
42378
  request['orderDataList'] = ordersRequests;
42169
42379
  request['marginCoin'] = market['settleId'];
42170
42380
  response = await this.privateMixPostOrderBatchOrders(request);
42171
42381
  }
42382
+ else if (marginMode === 'isolated') {
42383
+ response = await this.privateMarginPostIsolatedOrderBatchPlaceOrder(request);
42384
+ }
42385
+ else if (marginMode === 'cross') {
42386
+ response = await this.privateMarginPostCrossOrderBatchPlaceOrder(request);
42387
+ }
42388
+ else {
42389
+ response = await this.privateSpotPostTradeBatchOrders(request);
42390
+ }
42172
42391
  //
42173
42392
  // {
42174
42393
  // "code": "00000",
@@ -42236,11 +42455,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42236
42455
  if (!isStopOrder && !isTriggerOrder) {
42237
42456
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' editOrder() only support plan orders');
42238
42457
  }
42239
- let method = this.getSupportedMapping(marketType, {
42240
- 'spot': 'privateSpotPostPlanModifyPlan',
42241
- 'swap': 'privateMixPostPlanModifyPlan',
42242
- 'future': 'privateMixPostPlanModifyPlan',
42243
- });
42244
42458
  if (triggerPrice !== undefined) {
42245
42459
  // default triggerType to market price for unification
42246
42460
  const triggerType = this.safeString(params, 'triggerType', 'market_price');
@@ -42248,6 +42462,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42248
42462
  request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
42249
42463
  request['executePrice'] = this.priceToPrecision(symbol, price);
42250
42464
  }
42465
+ const omitted = this.omit(query, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice']);
42466
+ let response = undefined;
42251
42467
  if (marketType === 'spot') {
42252
42468
  if (isStopOrder) {
42253
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');
@@ -42267,10 +42483,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42267
42483
  else {
42268
42484
  request['size'] = this.amountToPrecision(symbol, amount);
42269
42485
  }
42486
+ response = await this.privateSpotPostPlanModifyPlan(this.extend(request, omitted));
42270
42487
  }
42271
42488
  else {
42272
42489
  request['symbol'] = market['id'];
42273
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'];
42274
42495
  if (isStopOrder) {
42275
42496
  if (!isMarketOrder) {
42276
42497
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' editOrder() bitget stopLoss or takeProfit orders must be market orders');
@@ -42283,12 +42504,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42283
42504
  request['triggerPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
42284
42505
  request['planType'] = 'profit_plan';
42285
42506
  }
42286
- method = 'privateMixPostPlanModifyTPSLPlan';
42507
+ response = await this.privateMixPostPlanModifyTPSLPlan(this.extend(request, omitted));
42508
+ }
42509
+ else {
42510
+ response = await this.privateMixPostPlanModifyPlan(this.extend(request, omitted));
42287
42511
  }
42288
- request['marginCoin'] = market['settleId'];
42289
42512
  }
42290
- const omitted = this.omit(query, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice']);
42291
- const response = await this[method](this.extend(request, omitted));
42292
42513
  //
42293
42514
  // spot
42294
42515
  // {
@@ -42618,16 +42839,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42618
42839
  await this.loadMarkets();
42619
42840
  const market = this.market(symbol);
42620
42841
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
42621
- const method = this.getSupportedMapping(marketType, {
42622
- 'spot': 'privateSpotPostTradeOrderInfo',
42623
- 'swap': 'privateMixGetOrderDetail',
42624
- 'future': 'privateMixGetOrderDetail',
42625
- });
42626
42842
  const request = {
42627
42843
  'symbol': market['id'],
42628
42844
  'orderId': id,
42629
42845
  };
42630
- 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
+ }
42631
42856
  // spot
42632
42857
  // {
42633
42858
  // code: '00000',
@@ -43553,16 +43778,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43553
43778
  await this.loadMarkets();
43554
43779
  const market = this.market(symbol);
43555
43780
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrderTrades', market, params);
43556
- const method = this.getSupportedMapping(marketType, {
43557
- 'spot': 'privateSpotPostTradeFills',
43558
- 'swap': 'privateMixGetOrderFills',
43559
- 'future': 'privateMixGetOrderFills',
43560
- });
43561
43781
  const request = {
43562
43782
  'symbol': market['id'],
43563
43783
  'orderId': id,
43564
43784
  };
43565
- 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
+ }
43566
43795
  // spot
43567
43796
  //
43568
43797
  // swap
@@ -44026,7 +44255,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44026
44255
  'previousFundingDatetime': undefined,
44027
44256
  };
44028
44257
  }
44029
- async fetchFundingHistory(symbol, since = undefined, limit = undefined, params = {}) {
44258
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
44030
44259
  /**
44031
44260
  * @method
44032
44261
  * @name bitget#fetchFundingHistory
@@ -44039,6 +44268,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
44039
44268
  * @returns {object[]} a list of [funding history structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-history-structure}
44040
44269
  */
44041
44270
  await this.loadMarkets();
44271
+ this.checkRequiredSymbol('fetchFundingHistory', symbol);
44042
44272
  const market = this.market(symbol);
44043
44273
  if (!market['swap']) {
44044
44274
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol(this.id + ' fetchFundingHistory() supports swap contracts only');
@@ -54567,14 +54797,15 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
54567
54797
  const request = {
54568
54798
  // 'pair': market['id'], // optional
54569
54799
  };
54570
- // privateDeleteOrdersAll or privateDeleteOrdersPair
54571
- let method = this.safeString(this.options, 'privateDeleteOrdersPair', 'privateDeleteOrdersAll');
54800
+ let response = undefined;
54572
54801
  if (symbol !== undefined) {
54573
54802
  const market = this.market(symbol);
54574
54803
  request['pair'] = market['id'];
54575
- method = 'privateDeleteOrdersPair';
54804
+ response = await this.privateDeleteOrdersPair(this.extend(request, params));
54805
+ }
54806
+ else {
54807
+ response = await this.privateDeleteOrdersAll(this.extend(request, params));
54576
54808
  }
54577
- const response = await this[method](this.extend(request, params));
54578
54809
  const result = this.safeValue(response, 'data', {});
54579
54810
  //
54580
54811
  // {
@@ -57980,6 +58211,16 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
57980
58211
  return orderbook;
57981
58212
  }
57982
58213
  parseTicker(ticker, market = undefined) {
58214
+ //
58215
+ // fetchBidsAsks
58216
+ //
58217
+ // {
58218
+ // "symbol": "LTCBTC",
58219
+ // "bidPrice": "4.00000000",
58220
+ // "bidQty": "431.00000000",
58221
+ // "askPrice": "4.00000200",
58222
+ // "askQty": "9.00000000"
58223
+ // }
57983
58224
  //
57984
58225
  // fetchTicker
57985
58226
  //
@@ -58004,10 +58245,10 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
58004
58245
  'datetime': undefined,
58005
58246
  'high': this.safeString(ticker, 'high24hr'),
58006
58247
  'low': this.safeString(ticker, 'low24hr'),
58007
- 'bid': this.safeString(ticker, 'highestBid'),
58008
- 'bidVolume': undefined,
58009
- 'ask': this.safeString(ticker, 'lowestAsk'),
58010
- 'askVolume': undefined,
58248
+ 'bid': this.safeString2(ticker, 'highestBid', 'bidPrice'),
58249
+ 'bidVolume': this.safeString(ticker, 'bidQty'),
58250
+ 'ask': this.safeString2(ticker, 'lowestAsk', 'askPrice'),
58251
+ 'askVolume': this.safeString(ticker, 'askQty'),
58011
58252
  'vwap': undefined,
58012
58253
  'open': undefined,
58013
58254
  'close': last,
@@ -58135,26 +58376,31 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
58135
58376
  * @method
58136
58377
  * @name bitrue#fetchBidsAsks
58137
58378
  * @description fetches the bid and ask price and volume for multiple markets
58379
+ * @see https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker
58138
58380
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
58139
58381
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
58140
58382
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
58141
58383
  */
58142
58384
  await this.loadMarkets();
58143
- const defaultType = this.safeString2(this.options, 'fetchBidsAsks', 'defaultType', 'spot');
58144
- const type = this.safeString(params, 'type', defaultType);
58145
- const query = this.omit(params, 'type');
58146
- let method = undefined;
58147
- if (type === 'future') {
58148
- method = 'fapiPublicGetTickerBookTicker';
58149
- }
58150
- else if (type === 'delivery') {
58151
- method = 'dapiPublicGetTickerBookTicker';
58152
- }
58153
- else {
58154
- method = 'publicGetTickerBookTicker';
58385
+ symbols = this.marketSymbols(symbols);
58386
+ let market = undefined;
58387
+ const request = {};
58388
+ if (symbols !== undefined) {
58389
+ const first = this.safeString(symbols, 0);
58390
+ market = this.market(first);
58391
+ request['symbol'] = market['id'];
58155
58392
  }
58156
- const response = await this[method](query);
58157
- return this.parseTickers(response, symbols);
58393
+ const response = await this.v1PublicGetTickerBookTicker(this.extend(request, params));
58394
+ // {
58395
+ // "symbol": "LTCBTC",
58396
+ // "bidPrice": "4.00000000",
58397
+ // "bidQty": "431.00000000",
58398
+ // "askPrice": "4.00000200",
58399
+ // "askQty": "9.00000000"
58400
+ // }
58401
+ const data = {};
58402
+ data[market['id']] = response;
58403
+ return this.parseTickers(data, symbols);
58158
58404
  }
58159
58405
  async fetchTickers(symbols = undefined, params = {}) {
58160
58406
  /**
@@ -66428,6 +66674,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66428
66674
  /**
66429
66675
  * @method
66430
66676
  * @name bitvavo#fetchTicker
66677
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get
66431
66678
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
66432
66679
  * @param {string} symbol unified symbol of the market to fetch the ticker for
66433
66680
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
@@ -66541,16 +66788,24 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66541
66788
  /**
66542
66789
  * @method
66543
66790
  * @name bitvavo#fetchTrades
66791
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get
66544
66792
  * @description get the list of most recent trades for a particular symbol
66545
66793
  * @param {string} symbol unified symbol of the market to fetch trades for
66546
66794
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
66547
66795
  * @param {int} [limit] the maximum amount of trades to fetch
66548
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)
66549
66799
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
66550
66800
  */
66551
66801
  await this.loadMarkets();
66552
66802
  const market = this.market(symbol);
66553
- 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 = {
66554
66809
  'market': market['id'],
66555
66810
  // 'limit': 500, // default 500, max 1000
66556
66811
  // 'start': since,
@@ -66564,6 +66819,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66564
66819
  if (since !== undefined) {
66565
66820
  request['start'] = since;
66566
66821
  }
66822
+ [request, params] = this.handleUntilOption('end', request, params);
66567
66823
  const response = await this.publicGetMarketTrades(this.extend(request, params));
66568
66824
  //
66569
66825
  // [
@@ -66714,6 +66970,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66714
66970
  /**
66715
66971
  * @method
66716
66972
  * @name bitvavo#fetchOrderBook
66973
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get
66717
66974
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
66718
66975
  * @param {string} symbol unified symbol of the market to fetch the order book for
66719
66976
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -66773,17 +67030,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66773
67030
  /**
66774
67031
  * @method
66775
67032
  * @name bitvavo#fetchOHLCV
67033
+ * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
66776
67034
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
66777
67035
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
66778
67036
  * @param {string} timeframe the length of time each candle represents
66779
67037
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
66780
67038
  * @param {int} [limit] the maximum amount of candles to fetch
66781
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)
66782
67042
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
66783
67043
  */
66784
67044
  await this.loadMarkets();
66785
67045
  const market = this.market(symbol);
66786
- 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 = {
66787
67052
  'market': market['id'],
66788
67053
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
66789
67054
  // 'limit': 1440, // default 1440, max 1440
@@ -66799,6 +67064,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
66799
67064
  }
66800
67065
  request['end'] = this.sum(since, limit * duration * 1000);
66801
67066
  }
67067
+ [request, params] = this.handleUntilOption('end', request, params);
66802
67068
  if (limit !== undefined) {
66803
67069
  request['limit'] = limit; // default 1440, max 1440
66804
67070
  }
@@ -67152,19 +67418,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67152
67418
  /**
67153
67419
  * @method
67154
67420
  * @name bitvavo#fetchOrders
67421
+ * @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/get
67155
67422
  * @description fetches information on multiple orders made by the user
67156
67423
  * @param {string} symbol unified market symbol of the market orders were made in
67157
67424
  * @param {int} [since] the earliest time in ms to fetch orders for
67158
67425
  * @param {int} [limit] the maximum number of orde structures to retrieve
67159
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
67160
67429
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
67161
67430
  */
67162
- if (symbol === undefined) {
67163
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
67164
- }
67431
+ this.checkRequiredSymbol('fetchOrders', symbol);
67165
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
+ }
67166
67438
  const market = this.market(symbol);
67167
- const request = {
67439
+ let request = {
67168
67440
  'market': market['id'],
67169
67441
  // 'limit': 500,
67170
67442
  // 'start': since,
@@ -67178,6 +67450,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67178
67450
  if (limit !== undefined) {
67179
67451
  request['limit'] = limit; // default 500, max 1000
67180
67452
  }
67453
+ [request, params] = this.handleUntilOption('end', request, params);
67181
67454
  const response = await this.privateGetOrders(this.extend(request, params));
67182
67455
  //
67183
67456
  // [
@@ -67402,19 +67675,27 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67402
67675
  /**
67403
67676
  * @method
67404
67677
  * @name bitvavo#fetchMyTrades
67678
+ * @see https://docs.bitvavo.com/#tag/Trades/paths/~1trades/get
67405
67679
  * @description fetch all trades made by the user
67406
67680
  * @param {string} symbol unified market symbol
67407
67681
  * @param {int} [since] the earliest time in ms to fetch trades for
67408
67682
  * @param {int} [limit] the maximum number of trades structures to retrieve
67409
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)
67410
67686
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
67411
67687
  */
67412
67688
  if (symbol === undefined) {
67413
67689
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
67414
67690
  }
67415
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
+ }
67416
67697
  const market = this.market(symbol);
67417
- const request = {
67698
+ let request = {
67418
67699
  'market': market['id'],
67419
67700
  // 'limit': 500,
67420
67701
  // 'start': since,
@@ -67428,6 +67709,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
67428
67709
  if (limit !== undefined) {
67429
67710
  request['limit'] = limit; // default 500, max 1000
67430
67711
  }
67712
+ [request, params] = this.handleUntilOption('end', request, params);
67431
67713
  const response = await this.privateGetTrades(this.extend(request, params));
67432
67714
  //
67433
67715
  // [
@@ -74955,9 +75237,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
74955
75237
  'deposit': {},
74956
75238
  },
74957
75239
  },
74958
- 'commonCurrencies': {
74959
- 'GAS': 'GASDAO',
74960
- },
74961
75240
  });
74962
75241
  }
74963
75242
  nonce() {
@@ -90619,7 +90898,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
90619
90898
  const remainingString = this.safeString(order, 'left');
90620
90899
  const marketId = this.safeString(order, 'market');
90621
90900
  const defaultType = this.safeString(this.options, 'defaultType');
90622
- market = this.safeMarket(marketId, market, undefined, defaultType);
90901
+ const orderType = ('source' in order) ? 'swap' : defaultType;
90902
+ market = this.safeMarket(marketId, market, undefined, orderType);
90623
90903
  const feeCurrencyId = this.safeString(order, 'fee_asset');
90624
90904
  let feeCurrency = this.safeCurrencyCode(feeCurrencyId);
90625
90905
  if (feeCurrency === undefined) {
@@ -118884,6 +119164,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
118884
119164
  * @method
118885
119165
  * @name gate#fetchCurrencies
118886
119166
  * @description fetches all available currencies on an exchange
119167
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
118887
119168
  * @param {object} [params] extra parameters specific to the gate api endpoint
118888
119169
  * @returns {object} an associative dictionary of currencies
118889
119170
  */
@@ -118994,6 +119275,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
118994
119275
  * @method
118995
119276
  * @name gate#fetchFundingRate
118996
119277
  * @description fetch the current funding rate
119278
+ * @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
118997
119279
  * @param {string} symbol unified market symbol
118998
119280
  * @param {object} [params] extra parameters specific to the gate api endpoint
118999
119281
  * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
@@ -119056,6 +119338,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119056
119338
  * @method
119057
119339
  * @name gate#fetchFundingRates
119058
119340
  * @description fetch the funding rate for multiple markets
119341
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
119059
119342
  * @param {string[]|undefined} symbols list of unified market symbols
119060
119343
  * @param {object} [params] extra parameters specific to the gate api endpoint
119061
119344
  * @returns {object} a dictionary of [funding rates structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure}, indexe by market symbols
@@ -119522,6 +119805,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119522
119805
  * @method
119523
119806
  * @name gate#fetchFundingHistory
119524
119807
  * @description fetch the history of funding payments paid and received on this account
119808
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
119809
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
119525
119810
  * @param {string} symbol unified market symbol
119526
119811
  * @param {int} [since] the earliest time in ms to fetch funding history for
119527
119812
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -120222,6 +120507,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120222
120507
  * @method
120223
120508
  * @name gate#fetchFundingRateHistory
120224
120509
  * @description fetches historical funding rate prices
120510
+ * @see https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
120225
120511
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
120226
120512
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
120227
120513
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
@@ -120315,6 +120601,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120315
120601
  * @method
120316
120602
  * @name gate#fetchTrades
120317
120603
  * @description get the list of most recent trades for a particular symbol
120604
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
120605
+ * @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
120606
+ * @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
120607
+ * @see https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
120318
120608
  * @param {string} symbol unified symbol of the market to fetch trades for
120319
120609
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
120320
120610
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -120418,6 +120708,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120418
120708
  * @method
120419
120709
  * @name gate#fetchOrderTrades
120420
120710
  * @description fetch all the trades made from a single order
120711
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
120712
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
120713
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
120714
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
120421
120715
  * @param {string} id order id
120422
120716
  * @param {string} symbol unified market symbol
120423
120717
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -120735,6 +121029,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120735
121029
  * @method
120736
121030
  * @name gate#fetchDeposits
120737
121031
  * @description fetch all deposits made to an account
121032
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
120738
121033
  * @param {string} code unified currency code
120739
121034
  * @param {int} [since] the earliest time in ms to fetch deposits for
120740
121035
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -120772,6 +121067,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120772
121067
  * @method
120773
121068
  * @name gate#fetchWithdrawals
120774
121069
  * @description fetch all withdrawals made from an account
121070
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
120775
121071
  * @param {string} code unified currency code
120776
121072
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
120777
121073
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -120809,6 +121105,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120809
121105
  * @method
120810
121106
  * @name gate#withdraw
120811
121107
  * @description make a withdrawal
121108
+ * @see https://www.gate.io/docs/developers/apiv4/en/#withdraw
120812
121109
  * @param {string} code unified currency code
120813
121110
  * @param {float} amount the amount to withdraw
120814
121111
  * @param {string} address the address to withdraw to
@@ -120955,6 +121252,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120955
121252
  * @method
120956
121253
  * @name gate#createOrder
120957
121254
  * @description Create an order on the exchange
121255
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-an-order
121256
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
121257
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
121258
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
121259
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
121260
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
121261
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
120958
121262
  * @param {string} symbol Unified CCXT market symbol
120959
121263
  * @param {string} type 'limit' or 'market' *"market" is contract only*
120960
121264
  * @param {string} side 'buy' or 'sell'
@@ -121767,6 +122071,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121767
122071
  * @method
121768
122072
  * @name gate#fetchOpenOrders
121769
122073
  * @description fetch all unfilled currently open orders
122074
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
121770
122075
  * @param {string} symbol unified market symbol
121771
122076
  * @param {int} [since] the earliest time in ms to fetch open orders for
121772
122077
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -121783,6 +122088,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121783
122088
  * @method
121784
122089
  * @name gate#fetchClosedOrders
121785
122090
  * @description fetches information on multiple closed orders made by the user
122091
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-orders
122092
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
122093
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
122094
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
122095
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
122096
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
122097
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
121786
122098
  * @param {string} symbol unified market symbol of the market orders were made in
121787
122099
  * @param {int} [since] the earliest time in ms to fetch orders for
121788
122100
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -121991,6 +122303,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121991
122303
  * @method
121992
122304
  * @name gate#cancelOrder
121993
122305
  * @description Cancels an open order
122306
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
122307
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
122308
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
122309
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
121994
122310
  * @param {string} id Order id
121995
122311
  * @param {string} symbol Unified market symbol
121996
122312
  * @param {object} [params] Parameters specified by the exchange api
@@ -122101,6 +122417,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122101
122417
  * @method
122102
122418
  * @name gate#cancelAllOrders
122103
122419
  * @description cancel all open orders
122420
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
122421
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
122422
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
122423
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
122104
122424
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
122105
122425
  * @param {object} [params] extra parameters specific to the gate api endpoint
122106
122426
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -122232,6 +122552,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122232
122552
  * @method
122233
122553
  * @name gate#setLeverage
122234
122554
  * @description set the level of leverage for a market
122555
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
122556
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
122235
122557
  * @param {float} leverage the rate of leverage
122236
122558
  * @param {string} symbol unified market symbol
122237
122559
  * @param {object} [params] extra parameters specific to the gate api endpoint
@@ -122596,6 +122918,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122596
122918
  * @method
122597
122919
  * @name gate#fetchLeverageTiers
122598
122920
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
122921
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
122922
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
122599
122923
  * @param {string[]|undefined} symbols list of unified market symbols
122600
122924
  * @param {object} [params] extra parameters specific to the gate api endpoint
122601
122925
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
@@ -122851,12 +123175,12 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122851
123175
  'currency': currency['id'],
122852
123176
  'amount': this.currencyToPrecision(code, amount),
122853
123177
  };
122854
- let method = undefined;
123178
+ let response = undefined;
123179
+ params = this.omit(params, ['marginMode']);
122855
123180
  if (symbol === undefined) {
122856
- method = 'privateMarginPostCrossRepayments';
123181
+ response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
122857
123182
  }
122858
123183
  else {
122859
- method = 'privateMarginPostLoansLoanIdRepayment';
122860
123184
  const market = this.market(symbol);
122861
123185
  request['currency_pair'] = market['id'];
122862
123186
  request['mode'] = 'partial';
@@ -122865,9 +123189,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122865
123189
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' repayMargin() requires loan_id param for isolated margin');
122866
123190
  }
122867
123191
  request['loan_id'] = loanId;
123192
+ params = this.omit(params, ['loan_id', 'id']);
123193
+ response = await this.privateMarginPostLoansLoanIdRepayment(this.extend(request, params));
122868
123194
  }
122869
- params = this.omit(params, ['marginMode', 'loan_id', 'id']);
122870
- let response = await this[method](this.extend(request, params));
122871
123195
  //
122872
123196
  // Cross
122873
123197
  //
@@ -122934,9 +123258,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122934
123258
  'currency': currency['id'],
122935
123259
  'amount': this.currencyToPrecision(code, amount),
122936
123260
  };
122937
- let method = undefined;
123261
+ let response = undefined;
122938
123262
  if (symbol === undefined) {
122939
- method = 'privateMarginPostCrossLoans';
123263
+ response = await this.privateMarginPostCrossLoans(this.extend(request, params));
122940
123264
  }
122941
123265
  else {
122942
123266
  const market = this.market(symbol);
@@ -122946,10 +123270,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122946
123270
  // as it is the smallest tick size currently offered by gateio
122947
123271
  request['rate'] = this.safeString(params, 'rate', '0.0001');
122948
123272
  request['auto_renew'] = true;
122949
- method = 'privateMarginPostLoans';
123273
+ params = this.omit(params, ['rate']);
123274
+ response = await this.privateMarginPostLoans(this.extend(request, params));
122950
123275
  }
122951
- params = this.omit(params, ['marginMode', 'rate']);
122952
- const response = await this[method](this.extend(request, params));
122953
123276
  //
122954
123277
  // Cross
122955
123278
  //
@@ -123173,6 +123496,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123173
123496
  * @method
123174
123497
  * @name gate#reduceMargin
123175
123498
  * @description remove margin from a position
123499
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
123500
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
123176
123501
  * @param {string} symbol unified market symbol
123177
123502
  * @param {float} amount the amount of margin to remove
123178
123503
  * @param {object} [params] extra parameters specific to the exmo api endpoint
@@ -123185,6 +123510,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123185
123510
  * @method
123186
123511
  * @name gate#addMargin
123187
123512
  * @description add margin
123513
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
123514
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
123188
123515
  * @param {string} symbol unified market symbol
123189
123516
  * @param {float} amount amount of margin to add
123190
123517
  * @param {object} [params] extra parameters specific to the exmo api endpoint
@@ -123722,6 +124049,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123722
124049
  * @method
123723
124050
  * @name gate#fetchUnderlyingAssets
123724
124051
  * @description fetches the market ids of underlying assets for a specific contract market type
124052
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
123725
124053
  * @param {object} [params] exchange specific params
123726
124054
  * @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
123727
124055
  * @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
@@ -124555,11 +124883,10 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
124555
124883
  }
124556
124884
  for (let i = 0; i < marketIds.length; i++) {
124557
124885
  const marketId = marketIds[i];
124558
- const method = 'publicGetV1SymbolsDetailsSymbol';
124559
124886
  const request = {
124560
124887
  'symbol': marketId,
124561
124888
  };
124562
- promises.push(this[method](this.extend(request, params)));
124889
+ promises.push(this.publicGetV1SymbolsDetailsSymbol(this.extend(request, params)));
124563
124890
  //
124564
124891
  // {
124565
124892
  // "symbol": "BTCUSD",
@@ -125835,6 +126162,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
125835
126162
  'cancelOrder': true,
125836
126163
  'createDepositAddress': true,
125837
126164
  'createOrder': true,
126165
+ 'createPostOnlyOrder': true,
125838
126166
  'createReduceOnlyOrder': true,
125839
126167
  'createStopLimitOrder': true,
125840
126168
  'createStopMarketOrder': true,
@@ -127849,14 +128177,24 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
127849
128177
  * @param {float} amount how much of currency you want to trade in units of base currency
127850
128178
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
127851
128179
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
127852
- * @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
127853
128181
  * @param {bool} [params.margin] true for creating a margin order
127854
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"
127855
128185
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
127856
128186
  */
127857
128187
  await this.loadMarkets();
127858
128188
  const market = this.market(symbol);
127859
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);
127860
128198
  const request = {
127861
128199
  'type': type,
127862
128200
  'side': side,
@@ -127874,7 +128212,6 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
127874
128212
  // 'take_rate': 0.001, // Optional
127875
128213
  // 'make_rate': 0.001, // Optional
127876
128214
  };
127877
- const reduceOnly = this.safeValue(params, 'reduceOnly');
127878
128215
  if (reduceOnly !== undefined) {
127879
128216
  if ((market['type'] !== 'swap') && (market['type'] !== 'margin')) {
127880
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');
@@ -127883,8 +128220,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
127883
128220
  if (reduceOnly === true) {
127884
128221
  request['reduce_only'] = reduceOnly;
127885
128222
  }
127886
- const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
127887
- 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
+ }
127888
128229
  if (isLimit || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
127889
128230
  if (price === undefined) {
127890
128231
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' createOrder() requires a price argument for limit orders');
@@ -127909,19 +128250,20 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
127909
128250
  else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
127910
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');
127911
128252
  }
127912
- let marketType = undefined;
127913
- [marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
127914
- let method = this.getSupportedMapping(marketType, {
127915
- 'spot': 'privatePostSpotOrder',
127916
- 'swap': 'privatePostFuturesOrder',
127917
- 'margin': 'privatePostMarginOrder',
127918
- });
127919
- const [marginMode, query] = this.handleMarginModeAndParams('createOrder', params);
127920
- if (marginMode !== undefined) {
127921
- 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));
127922
128266
  }
127923
- params = this.omit(params, ['triggerPrice', 'timeInForce', 'time_in_force', 'stopPrice', 'stop_price', 'reduceOnly']);
127924
- const response = await this[method](this.extend(request, query));
127925
128267
  return this.parseOrder(response, market);
127926
128268
  }
127927
128269
  parseOrderStatus(status) {
@@ -128844,12 +129186,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
128844
129186
  const isMargin = this.safeValue(params, 'margin', false);
128845
129187
  let marginMode = undefined;
128846
129188
  [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
128847
- if (marginMode !== undefined) {
128848
- if (marginMode !== 'isolated') {
128849
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' only isolated margin is supported');
128850
- }
128851
- }
128852
- else {
129189
+ if (marginMode === undefined) {
128853
129190
  if ((defaultType === 'margin') || (isMargin === true)) {
128854
129191
  marginMode = 'isolated';
128855
129192
  }
@@ -131901,7 +132238,6 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
131901
132238
  'GET': 'Themis',
131902
132239
  'GTC': 'Game.com',
131903
132240
  'HIT': 'HitChain',
131904
- 'HOT': 'Hydro Protocol',
131905
132241
  // https://github.com/ccxt/ccxt/issues/7399
131906
132242
  // https://coinmarketcap.com/currencies/pnetwork/
131907
132243
  // https://coinmarketcap.com/currencies/penta/markets/
@@ -139515,7 +139851,6 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
139515
139851
  'GET': 'Themis',
139516
139852
  'GTC': 'Game.com',
139517
139853
  'HIT': 'HitChain',
139518
- 'HOT': 'Hydro Protocol',
139519
139854
  // https://github.com/ccxt/ccxt/issues/7399
139520
139855
  // https://coinmarketcap.com/currencies/pnetwork/
139521
139856
  // https://coinmarketcap.com/currencies/penta/markets/
@@ -149352,7 +149687,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
149352
149687
  result.push({
149353
149688
  'info': item,
149354
149689
  'symbol': symbol,
149355
- 'fundingRate': this.safeNumber(item, 'fundingRate'),
149690
+ 'fundingRate': this.safeNumber(item, 'relativeFundingRate'),
149356
149691
  'timestamp': this.parse8601(datetime),
149357
149692
  'datetime': datetime,
149358
149693
  });
@@ -166304,8 +166639,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166304
166639
  'spot': true,
166305
166640
  'margin': true,
166306
166641
  'swap': true,
166307
- 'future': true,
166308
- 'option': undefined,
166642
+ 'future': false,
166643
+ 'option': false,
166309
166644
  'addMargin': true,
166310
166645
  'borrowMargin': true,
166311
166646
  'cancelAllOrders': true,
@@ -166673,10 +167008,6 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166673
167008
  'fetchMarkets': {
166674
167009
  'types': {
166675
167010
  'spot': true,
166676
- 'future': {
166677
- 'linear': false,
166678
- 'inverse': false,
166679
- },
166680
167011
  'swap': {
166681
167012
  'linear': true,
166682
167013
  'inverse': false,
@@ -182909,6 +183240,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
182909
183240
  parseOrderStatus(status) {
182910
183241
  const statuses = {
182911
183242
  'canceled': 'canceled',
183243
+ 'order_failed': 'canceled',
182912
183244
  'live': 'open',
182913
183245
  'partially_filled': 'open',
182914
183246
  'filled': 'closed',
@@ -189224,6 +189556,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
189224
189556
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
189225
189557
  let method = 'privateGetSpotWallets';
189226
189558
  const request = {};
189559
+ if ((type !== 'spot') && (type !== 'swap')) {
189560
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' does not support ' + type + ' markets, only spot and swap');
189561
+ }
189227
189562
  if (type === 'swap') {
189228
189563
  const code = this.safeString(params, 'code');
189229
189564
  let settle = undefined;
@@ -224338,6 +224673,7 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
224338
224673
  // id: 1583473663565,
224339
224674
  // rep: 'market.btcusdt.mbp.150',
224340
224675
  // status: 'ok',
224676
+ // ts: 1698359289261,
224341
224677
  // data: {
224342
224678
  // seqNum: 104999417756,
224343
224679
  // bids: [
@@ -224366,6 +224702,9 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
224366
224702
  const sequence = this.safeInteger(tick, 'seqNum');
224367
224703
  const nonce = this.safeInteger(data, 'seqNum');
224368
224704
  snapshot['nonce'] = nonce;
224705
+ const timestamp = this.safeInteger(message, 'ts');
224706
+ snapshot['timestamp'] = timestamp;
224707
+ snapshot['datetime'] = this.iso8601(timestamp);
224369
224708
  const snapshotLimit = this.safeInteger(subscription, 'limit');
224370
224709
  const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
224371
224710
  client.resolve(snapshotOrderBook, id);
@@ -279395,7 +279734,7 @@ SOFTWARE.
279395
279734
 
279396
279735
  //-----------------------------------------------------------------------------
279397
279736
  // this is updated by vss.js when building
279398
- const version = '4.1.29';
279737
+ const version = '4.1.31';
279399
279738
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
279400
279739
  //-----------------------------------------------------------------------------
279401
279740