ccxt 4.1.30 → 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.
@@ -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
  }
@@ -166497,8 +166639,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166497
166639
  'spot': true,
166498
166640
  'margin': true,
166499
166641
  'swap': true,
166500
- 'future': true,
166501
- 'option': undefined,
166642
+ 'future': false,
166643
+ 'option': false,
166502
166644
  'addMargin': true,
166503
166645
  'borrowMargin': true,
166504
166646
  'cancelAllOrders': true,
@@ -166866,10 +167008,6 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166866
167008
  'fetchMarkets': {
166867
167009
  'types': {
166868
167010
  'spot': true,
166869
- 'future': {
166870
- 'linear': false,
166871
- 'inverse': false,
166872
- },
166873
167011
  'swap': {
166874
167012
  'linear': true,
166875
167013
  'inverse': false,
@@ -183102,6 +183240,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
183102
183240
  parseOrderStatus(status) {
183103
183241
  const statuses = {
183104
183242
  'canceled': 'canceled',
183243
+ 'order_failed': 'canceled',
183105
183244
  'live': 'open',
183106
183245
  'partially_filled': 'open',
183107
183246
  'filled': 'closed',
@@ -279595,7 +279734,7 @@ SOFTWARE.
279595
279734
 
279596
279735
  //-----------------------------------------------------------------------------
279597
279736
  // this is updated by vss.js when building
279598
- const version = '4.1.30';
279737
+ const version = '4.1.31';
279599
279738
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
279600
279739
  //-----------------------------------------------------------------------------
279601
279740