ccxt 4.2.86 → 4.2.88

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 (103) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +4 -5
  3. package/dist/ccxt.browser.js +748 -169
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +6 -1
  6. package/dist/cjs/src/ascendex.js +11 -1
  7. package/dist/cjs/src/base/Exchange.js +26 -2
  8. package/dist/cjs/src/binance.js +24 -7
  9. package/dist/cjs/src/bingx.js +37 -1
  10. package/dist/cjs/src/bitfinex.js +3 -0
  11. package/dist/cjs/src/bitfinex2.js +16 -1
  12. package/dist/cjs/src/bitflyer.js +19 -0
  13. package/dist/cjs/src/bitget.js +32 -17
  14. package/dist/cjs/src/bitopro.js +3 -0
  15. package/dist/cjs/src/bitrue.js +13 -7
  16. package/dist/cjs/src/bitvavo.js +3 -0
  17. package/dist/cjs/src/btcmarkets.js +1 -1
  18. package/dist/cjs/src/btcturk.js +2 -1
  19. package/dist/cjs/src/coinex.js +182 -54
  20. package/dist/cjs/src/cryptocom.js +1 -1
  21. package/dist/cjs/src/currencycom.js +1 -1
  22. package/dist/cjs/src/delta.js +3 -1
  23. package/dist/cjs/src/digifinex.js +4 -2
  24. package/dist/cjs/src/exmo.js +11 -12
  25. package/dist/cjs/src/gate.js +13 -10
  26. package/dist/cjs/src/hitbtc.js +26 -2
  27. package/dist/cjs/src/htx.js +2 -2
  28. package/dist/cjs/src/huobijp.js +1 -1
  29. package/dist/cjs/src/hyperliquid.js +249 -12
  30. package/dist/cjs/src/idex.js +1 -1
  31. package/dist/cjs/src/krakenfutures.js +4 -7
  32. package/dist/cjs/src/kucoin.js +7 -4
  33. package/dist/cjs/src/lbank.js +3 -0
  34. package/dist/cjs/src/mexc.js +1 -1
  35. package/dist/cjs/src/oceanex.js +1 -1
  36. package/dist/cjs/src/okx.js +24 -10
  37. package/dist/cjs/src/phemex.js +3 -1
  38. package/dist/cjs/src/pro/kucoin.js +11 -6
  39. package/dist/cjs/src/wazirx.js +1 -1
  40. package/dist/cjs/src/zonda.js +3 -0
  41. package/examples/js/benchmark.js +104 -0
  42. package/examples/js/cli.js +0 -2
  43. package/examples/ts/benchmark.ts +134 -0
  44. package/examples/ts/cli.ts +0 -2
  45. package/js/ccxt.d.ts +3 -3
  46. package/js/ccxt.js +3 -3
  47. package/js/src/ascendex.d.ts +5 -12
  48. package/js/src/ascendex.js +11 -1
  49. package/js/src/base/Exchange.d.ts +5 -4
  50. package/js/src/base/Exchange.js +26 -2
  51. package/js/src/base/types.d.ts +12 -1
  52. package/js/src/binance.d.ts +5 -12
  53. package/js/src/binance.js +24 -7
  54. package/js/src/bingx.d.ts +5 -2
  55. package/js/src/bingx.js +37 -1
  56. package/js/src/bitfinex.js +3 -0
  57. package/js/src/bitfinex2.d.ts +3 -17
  58. package/js/src/bitfinex2.js +16 -1
  59. package/js/src/bitflyer.d.ts +1 -0
  60. package/js/src/bitflyer.js +20 -1
  61. package/js/src/bitget.d.ts +5 -12
  62. package/js/src/bitget.js +32 -17
  63. package/js/src/bitopro.js +3 -0
  64. package/js/src/bitrue.d.ts +3 -17
  65. package/js/src/bitrue.js +13 -7
  66. package/js/src/bitvavo.js +3 -0
  67. package/js/src/btcmarkets.js +1 -1
  68. package/js/src/btcturk.js +2 -1
  69. package/js/src/coinex.d.ts +4 -11
  70. package/js/src/coinex.js +182 -54
  71. package/js/src/cryptocom.js +1 -1
  72. package/js/src/currencycom.js +1 -1
  73. package/js/src/delta.d.ts +5 -37
  74. package/js/src/delta.js +3 -1
  75. package/js/src/digifinex.d.ts +5 -13
  76. package/js/src/digifinex.js +4 -2
  77. package/js/src/exmo.d.ts +5 -37
  78. package/js/src/exmo.js +11 -12
  79. package/js/src/gate.d.ts +5 -33
  80. package/js/src/gate.js +13 -10
  81. package/js/src/hitbtc.d.ts +5 -12
  82. package/js/src/hitbtc.js +26 -2
  83. package/js/src/htx.js +2 -2
  84. package/js/src/huobijp.js +1 -1
  85. package/js/src/hyperliquid.d.ts +7 -4
  86. package/js/src/hyperliquid.js +249 -12
  87. package/js/src/idex.js +1 -1
  88. package/js/src/krakenfutures.js +4 -7
  89. package/js/src/kucoin.js +7 -4
  90. package/js/src/kucoinfutures.d.ts +2 -2
  91. package/js/src/lbank.js +3 -0
  92. package/js/src/mexc.d.ts +3 -3
  93. package/js/src/mexc.js +1 -1
  94. package/js/src/oceanex.js +1 -1
  95. package/js/src/okx.d.ts +5 -33
  96. package/js/src/okx.js +24 -10
  97. package/js/src/phemex.d.ts +3 -11
  98. package/js/src/phemex.js +3 -1
  99. package/js/src/pro/kucoin.js +11 -6
  100. package/js/src/wazirx.js +1 -1
  101. package/js/src/zonda.js +3 -0
  102. package/package.json +3 -2
  103. package/skip-tests.json +3 -3
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.2.86';
185
+ const version = '4.2.88';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -374,8 +374,10 @@ exports.BadResponse = errors.BadResponse;
374
374
  exports.BadSymbol = errors.BadSymbol;
375
375
  exports.BaseError = errors.BaseError;
376
376
  exports.CancelPending = errors.CancelPending;
377
+ exports.ContractUnavailable = errors.ContractUnavailable;
377
378
  exports.DDoSProtection = errors.DDoSProtection;
378
379
  exports.DuplicateOrderId = errors.DuplicateOrderId;
380
+ exports.ExchangeClosedByUser = errors.ExchangeClosedByUser;
379
381
  exports.ExchangeError = errors.ExchangeError;
380
382
  exports.ExchangeNotAvailable = errors.ExchangeNotAvailable;
381
383
  exports.InsufficientFunds = errors.InsufficientFunds;
@@ -388,11 +390,14 @@ exports.NoChange = errors.NoChange;
388
390
  exports.NotSupported = errors.NotSupported;
389
391
  exports.NullResponse = errors.NullResponse;
390
392
  exports.OnMaintenance = errors.OnMaintenance;
393
+ exports.OperationFailed = errors.OperationFailed;
394
+ exports.OperationRejected = errors.OperationRejected;
391
395
  exports.OrderImmediatelyFillable = errors.OrderImmediatelyFillable;
392
396
  exports.OrderNotCached = errors.OrderNotCached;
393
397
  exports.OrderNotFillable = errors.OrderNotFillable;
394
398
  exports.OrderNotFound = errors.OrderNotFound;
395
399
  exports.PermissionDenied = errors.PermissionDenied;
400
+ exports.ProxyError = errors.ProxyError;
396
401
  exports.RateLimitExceeded = errors.RateLimitExceeded;
397
402
  exports.RequestTimeout = errors.RequestTimeout;
398
403
  exports.errors = errors;
@@ -2873,15 +2873,25 @@ class ascendex extends ascendex$1 {
2873
2873
  });
2874
2874
  }
2875
2875
  parseMarginModification(data, market = undefined) {
2876
+ //
2877
+ // addMargin/reduceMargin
2878
+ //
2879
+ // {
2880
+ // "code": 0
2881
+ // }
2882
+ //
2876
2883
  const errorCode = this.safeString(data, 'code');
2877
2884
  const status = (errorCode === '0') ? 'ok' : 'failed';
2878
2885
  return {
2879
2886
  'info': data,
2887
+ 'symbol': market['symbol'],
2880
2888
  'type': undefined,
2881
2889
  'amount': undefined,
2890
+ 'total': undefined,
2882
2891
  'code': market['quote'],
2883
- 'symbol': market['symbol'],
2884
2892
  'status': status,
2893
+ 'timestamp': undefined,
2894
+ 'datetime': undefined,
2885
2895
  };
2886
2896
  }
2887
2897
  async reduceMargin(symbol, amount, params = {}) {
@@ -4720,6 +4720,30 @@ class Exchange {
4720
4720
  }
4721
4721
  return parsedPrecision + '1';
4722
4722
  }
4723
+ integerPrecisionToAmount(precision) {
4724
+ /**
4725
+ * @ignore
4726
+ * @method
4727
+ * @description handles positive & negative numbers too. parsePrecision() does not handle negative numbers, but this method handles
4728
+ * @param {string} precision The number of digits to the right of the decimal
4729
+ * @returns {string} a string number equal to 1e-precision
4730
+ */
4731
+ if (precision === undefined) {
4732
+ return undefined;
4733
+ }
4734
+ if (Precise["default"].stringGe(precision, '0')) {
4735
+ return this.parsePrecision(precision);
4736
+ }
4737
+ else {
4738
+ const positivePrecisionString = Precise["default"].stringAbs(precision);
4739
+ const positivePrecision = parseInt(positivePrecisionString);
4740
+ let parsedPrecision = '1';
4741
+ for (let i = 0; i < positivePrecision - 1; i++) {
4742
+ parsedPrecision = parsedPrecision + '0';
4743
+ }
4744
+ return parsedPrecision + '0';
4745
+ }
4746
+ }
4723
4747
  async loadTimeDifference(params = {}) {
4724
4748
  const serverTime = await this.fetchTime(params);
4725
4749
  const after = this.milliseconds();
@@ -5200,8 +5224,8 @@ class Exchange {
5200
5224
  const entry = responseKeys[i];
5201
5225
  const dictionary = isArray ? entry : response[entry];
5202
5226
  const currencyId = isArray ? this.safeString(dictionary, currencyIdKey) : entry;
5203
- const currency = this.safeValue(this.currencies_by_id, currencyId);
5204
- const code = this.safeString(currency, 'code', currencyId);
5227
+ const currency = this.safeCurrency(currencyId);
5228
+ const code = this.safeString(currency, 'code');
5205
5229
  if ((codes === undefined) || (this.inArray(code, codes))) {
5206
5230
  depositWithdrawFees[code] = this.parseDepositWithdrawFee(dictionary, currency);
5207
5231
  }
@@ -1860,7 +1860,7 @@ class binance extends binance$1 {
1860
1860
  '-4140': errors.BadRequest,
1861
1861
  '-4141': errors.OperationRejected,
1862
1862
  '-4144': errors.BadSymbol,
1863
- '-4164': errors.OperationRejected,
1863
+ '-4164': errors.InvalidOrder,
1864
1864
  '-4165': errors.BadRequest,
1865
1865
  '-4167': errors.BadRequest,
1866
1866
  '-4168': errors.BadRequest,
@@ -9140,7 +9140,7 @@ class binance extends binance$1 {
9140
9140
  'previousFundingDatetime': undefined,
9141
9141
  };
9142
9142
  }
9143
- parseAccountPositions(account) {
9143
+ parseAccountPositions(account, filterClosed = false) {
9144
9144
  const positions = this.safeList(account, 'positions');
9145
9145
  const assets = this.safeList(account, 'assets', []);
9146
9146
  const balances = {};
@@ -9163,7 +9163,8 @@ class binance extends binance$1 {
9163
9163
  const code = market['linear'] ? market['quote'] : market['base'];
9164
9164
  const maintenanceMargin = this.safeString(position, 'maintMargin');
9165
9165
  // check for maintenance margin so empty positions are not returned
9166
- if ((maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000')) {
9166
+ const isPositionOpen = (maintenanceMargin !== '0') && (maintenanceMargin !== '0.00000000');
9167
+ if (!filterClosed || isPositionOpen) {
9167
9168
  // sometimes not all the codes are correctly returned...
9168
9169
  if (code in balances) {
9169
9170
  const parsed = this.parseAccountPosition(this.extend(position, {
@@ -10005,10 +10006,11 @@ class binance extends binance$1 {
10005
10006
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
10006
10007
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-um-account-detail-user_data
10007
10008
  * @see https://binance-docs.github.io/apidocs/pm/en/#get-cm-account-detail-user_data
10008
- * @param {string[]|undefined} symbols list of unified market symbols
10009
+ * @param {string[]} [symbols] list of unified market symbols
10009
10010
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10010
10011
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions in a portfolio margin account
10011
10012
  * @param {string} [params.subType] "linear" or "inverse"
10013
+ * @param {boolean} [params.filterClosed] set to true if you would like to filter out closed positions, default is false
10012
10014
  * @returns {object} data on account positions
10013
10015
  */
10014
10016
  if (symbols !== undefined) {
@@ -10045,7 +10047,9 @@ class binance extends binance$1 {
10045
10047
  else {
10046
10048
  throw new errors.NotSupported(this.id + ' fetchPositions() supports linear and inverse contracts only');
10047
10049
  }
10048
- const result = this.parseAccountPositions(response);
10050
+ let filterClosed = undefined;
10051
+ [filterClosed, params] = this.handleOptionAndParams(params, 'fetchAccountPositions', 'filterClosed', false);
10052
+ const result = this.parseAccountPositions(response, filterClosed);
10049
10053
  symbols = this.marketSymbols(symbols);
10050
10054
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
10051
10055
  }
@@ -11183,7 +11187,7 @@ class binance extends binance$1 {
11183
11187
  }
11184
11188
  await this.loadMarkets();
11185
11189
  const market = this.market(symbol);
11186
- amount = this.costToPrecision(symbol, amount);
11190
+ amount = this.amountToPrecision(symbol, amount);
11187
11191
  const request = {
11188
11192
  'type': addOrReduce,
11189
11193
  'symbol': market['id'],
@@ -11212,6 +11216,16 @@ class binance extends binance$1 {
11212
11216
  });
11213
11217
  }
11214
11218
  parseMarginModification(data, market = undefined) {
11219
+ //
11220
+ // add/reduce margin
11221
+ //
11222
+ // {
11223
+ // "code": 200,
11224
+ // "msg": "Successfully modify position margin.",
11225
+ // "amount": 0.001,
11226
+ // "type": 1
11227
+ // }
11228
+ //
11215
11229
  const rawType = this.safeInteger(data, 'type');
11216
11230
  const resultType = (rawType === 1) ? 'add' : 'reduce';
11217
11231
  const resultAmount = this.safeNumber(data, 'amount');
@@ -11219,11 +11233,14 @@ class binance extends binance$1 {
11219
11233
  const status = (errorCode === '200') ? 'ok' : 'failed';
11220
11234
  return {
11221
11235
  'info': data,
11236
+ 'symbol': market['symbol'],
11222
11237
  'type': resultType,
11223
11238
  'amount': resultAmount,
11239
+ 'total': undefined,
11224
11240
  'code': undefined,
11225
- 'symbol': market['symbol'],
11226
11241
  'status': status,
11242
+ 'timestamp': undefined,
11243
+ 'datetime': undefined,
11227
11244
  };
11228
11245
  }
11229
11246
  async reduceMargin(symbol, amount, params = {}) {
@@ -30,6 +30,7 @@ class bingx extends bingx$1 {
30
30
  'swap': true,
31
31
  'future': false,
32
32
  'option': false,
33
+ 'addMargin': true,
33
34
  'cancelAllOrders': true,
34
35
  'cancelOrder': true,
35
36
  'cancelOrders': true,
@@ -76,6 +77,7 @@ class bingx extends bingx$1 {
76
77
  'fetchTrades': true,
77
78
  'fetchTransfers': true,
78
79
  'fetchWithdrawals': true,
80
+ 'reduceMargin': true,
79
81
  'setLeverage': true,
80
82
  'setMargin': true,
81
83
  'setMarginMode': true,
@@ -3464,6 +3466,18 @@ class bingx extends bingx$1 {
3464
3466
  };
3465
3467
  return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
3466
3468
  }
3469
+ async addMargin(symbol, amount, params = {}) {
3470
+ const request = {
3471
+ 'type': 1,
3472
+ };
3473
+ return await this.setMargin(symbol, amount, this.extend(request, params));
3474
+ }
3475
+ async reduceMargin(symbol, amount, params = {}) {
3476
+ const request = {
3477
+ 'type': 2,
3478
+ };
3479
+ return await this.setMargin(symbol, amount, this.extend(request, params));
3480
+ }
3467
3481
  async setMargin(symbol, amount, params = {}) {
3468
3482
  /**
3469
3483
  * @method
@@ -3498,7 +3512,29 @@ class bingx extends bingx$1 {
3498
3512
  // "type": 1
3499
3513
  // }
3500
3514
  //
3501
- return response;
3515
+ return this.parseMarginModification(response, market);
3516
+ }
3517
+ parseMarginModification(data, market = undefined) {
3518
+ //
3519
+ // {
3520
+ // "code": 0,
3521
+ // "msg": "",
3522
+ // "amount": 1,
3523
+ // "type": 1
3524
+ // }
3525
+ //
3526
+ const type = this.safeString(data, 'type');
3527
+ return {
3528
+ 'info': data,
3529
+ 'symbol': this.safeString(market, 'symbol'),
3530
+ 'type': (type === '1') ? 'add' : 'reduce',
3531
+ 'amount': this.safeNumber(data, 'amount'),
3532
+ 'total': this.safeNumber(data, 'margin'),
3533
+ 'code': this.safeString(market, 'settle'),
3534
+ 'status': undefined,
3535
+ 'timestamp': undefined,
3536
+ 'datetime': undefined,
3537
+ };
3502
3538
  }
3503
3539
  async fetchLeverage(symbol, params = {}) {
3504
3540
  /**
@@ -1323,6 +1323,9 @@ class bitfinex extends bitfinex$1 {
1323
1323
  if (limit === undefined) {
1324
1324
  limit = 100;
1325
1325
  }
1326
+ else {
1327
+ limit = Math.min(limit, 10000);
1328
+ }
1326
1329
  const market = this.market(symbol);
1327
1330
  const v2id = 't' + market['id'];
1328
1331
  const request = {
@@ -1380,6 +1380,9 @@ class bitfinex2 extends bitfinex2$1 {
1380
1380
  if (limit === undefined) {
1381
1381
  limit = 10000;
1382
1382
  }
1383
+ else {
1384
+ limit = Math.min(limit, 10000);
1385
+ }
1383
1386
  let request = {
1384
1387
  'symbol': market['id'],
1385
1388
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
@@ -3501,15 +3504,27 @@ class bitfinex2 extends bitfinex2$1 {
3501
3504
  return this.parseMarginModification(data, market);
3502
3505
  }
3503
3506
  parseMarginModification(data, market = undefined) {
3507
+ //
3508
+ // setMargin
3509
+ //
3510
+ // [
3511
+ // [
3512
+ // 1
3513
+ // ]
3514
+ // ]
3515
+ //
3504
3516
  const marginStatusRaw = data[0];
3505
3517
  const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
3506
3518
  return {
3507
3519
  'info': data,
3520
+ 'symbol': market['symbol'],
3508
3521
  'type': undefined,
3509
3522
  'amount': undefined,
3523
+ 'total': undefined,
3510
3524
  'code': undefined,
3511
- 'symbol': market['symbol'],
3512
3525
  'status': marginStatus,
3526
+ 'timestamp': undefined,
3527
+ 'datetime': undefined,
3513
3528
  };
3514
3529
  }
3515
3530
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -114,6 +114,11 @@ class bitflyer extends bitflyer$1 {
114
114
  },
115
115
  },
116
116
  'precisionMode': number.TICK_SIZE,
117
+ 'exceptions': {
118
+ 'exact': {
119
+ '-2': errors.OnMaintenance, // {"status":-2,"error_message":"Under maintenance","data":null}
120
+ },
121
+ },
117
122
  });
118
123
  }
119
124
  parseExpiryDate(expiry) {
@@ -1041,6 +1046,20 @@ class bitflyer extends bitflyer$1 {
1041
1046
  }
1042
1047
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1043
1048
  }
1049
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1050
+ if (response === undefined) {
1051
+ return undefined; // fallback to the default error handler
1052
+ }
1053
+ const feedback = this.id + ' ' + body;
1054
+ // i.e. {"status":-2,"error_message":"Under maintenance","data":null}
1055
+ const errorMessage = this.safeString(response, 'error_message');
1056
+ const statusCode = this.safeNumber(response, 'status');
1057
+ if (errorMessage !== undefined) {
1058
+ this.throwExactlyMatchedException(this.exceptions['exact'], statusCode, feedback);
1059
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
1060
+ }
1061
+ return undefined;
1062
+ }
1044
1063
  }
1045
1064
 
1046
1065
  module.exports = bitflyer;
@@ -1219,6 +1219,7 @@ class bitget extends bitget$1 {
1219
1219
  '40768': errors.OrderNotFound,
1220
1220
  '41114': errors.OnMaintenance,
1221
1221
  '43011': errors.InvalidOrder,
1222
+ '43012': errors.InsufficientFunds,
1222
1223
  '43025': errors.InvalidOrder,
1223
1224
  '43115': errors.OnMaintenance,
1224
1225
  '45110': errors.InvalidOrder,
@@ -1294,6 +1295,7 @@ class bitget extends bitget$1 {
1294
1295
  'commonCurrencies': {
1295
1296
  'JADE': 'Jade Protocol',
1296
1297
  'DEGEN': 'DegenReborn',
1298
+ 'TONCOIN': 'TON',
1297
1299
  },
1298
1300
  'options': {
1299
1301
  'timeframes': {
@@ -1873,8 +1875,8 @@ class bitget extends bitget$1 {
1873
1875
  const data = this.safeValue(response, 'data', []);
1874
1876
  for (let i = 0; i < data.length; i++) {
1875
1877
  const entry = data[i];
1876
- const id = this.safeString(entry, 'coinId');
1877
- const code = this.safeCurrencyCode(this.safeString(entry, 'coin'));
1878
+ const id = this.safeString(entry, 'coin'); // we don't use 'coinId' as it has no use. it is 'coin' field that needs to be used in currency related endpoints (deposit, withdraw, etc..)
1879
+ const code = this.safeCurrencyCode(id);
1878
1880
  const chains = this.safeValue(entry, 'chains', []);
1879
1881
  const networks = {};
1880
1882
  let deposit = false;
@@ -2003,7 +2005,7 @@ class bitget extends bitget$1 {
2003
2005
  }
2004
2006
  params = this.omit(params, 'code');
2005
2007
  const currency = this.currency(code);
2006
- request['coin'] = currency['code'];
2008
+ request['coin'] = currency['id'];
2007
2009
  response = await this.privateMarginGetV2MarginCrossedTierData(this.extend(request, params));
2008
2010
  }
2009
2011
  else {
@@ -2159,7 +2161,7 @@ class bitget extends bitget$1 {
2159
2161
  since = this.milliseconds() - 7776000000; // 90 days
2160
2162
  }
2161
2163
  let request = {
2162
- 'coin': currency['code'],
2164
+ 'coin': currency['id'],
2163
2165
  'startTime': since,
2164
2166
  'endTime': this.milliseconds(),
2165
2167
  };
@@ -2218,7 +2220,7 @@ class bitget extends bitget$1 {
2218
2220
  const currency = this.currency(code);
2219
2221
  const networkId = this.networkCodeToId(chain);
2220
2222
  const request = {
2221
- 'coin': currency['code'],
2223
+ 'coin': currency['id'],
2222
2224
  'address': address,
2223
2225
  'chain': networkId,
2224
2226
  'size': amount,
@@ -2304,7 +2306,7 @@ class bitget extends bitget$1 {
2304
2306
  since = this.milliseconds() - 7776000000; // 90 days
2305
2307
  }
2306
2308
  let request = {
2307
- 'coin': currency['code'],
2309
+ 'coin': currency['id'],
2308
2310
  'startTime': since,
2309
2311
  'endTime': this.milliseconds(),
2310
2312
  };
@@ -2447,7 +2449,7 @@ class bitget extends bitget$1 {
2447
2449
  }
2448
2450
  const currency = this.currency(code);
2449
2451
  const request = {
2450
- 'coin': currency['code'],
2452
+ 'coin': currency['id'],
2451
2453
  };
2452
2454
  if (networkId !== undefined) {
2453
2455
  request['chain'] = networkId;
@@ -5900,7 +5902,7 @@ class bitget extends bitget$1 {
5900
5902
  let request = {};
5901
5903
  if (code !== undefined) {
5902
5904
  currency = this.currency(code);
5903
- request['coin'] = currency['code'];
5905
+ request['coin'] = currency['id'];
5904
5906
  }
5905
5907
  [request, params] = this.handleUntilOption('endTime', request, params);
5906
5908
  if (since !== undefined) {
@@ -6960,15 +6962,28 @@ class bitget extends bitget$1 {
6960
6962
  });
6961
6963
  }
6962
6964
  parseMarginModification(data, market = undefined) {
6965
+ //
6966
+ // addMargin/reduceMargin
6967
+ //
6968
+ // {
6969
+ // "code": "00000",
6970
+ // "msg": "success",
6971
+ // "requestTime": 1700813444618,
6972
+ // "data": ""
6973
+ // }
6974
+ //
6963
6975
  const errorCode = this.safeString(data, 'code');
6964
6976
  const status = (errorCode === '00000') ? 'ok' : 'failed';
6965
6977
  return {
6966
6978
  'info': data,
6979
+ 'symbol': market['symbol'],
6967
6980
  'type': undefined,
6968
6981
  'amount': undefined,
6982
+ 'total': undefined,
6969
6983
  'code': market['settle'],
6970
- 'symbol': market['symbol'],
6971
6984
  'status': status,
6985
+ 'timestamp': undefined,
6986
+ 'datetime': undefined,
6972
6987
  };
6973
6988
  }
6974
6989
  async reduceMargin(symbol, amount, params = {}) {
@@ -7326,7 +7341,7 @@ class bitget extends bitget$1 {
7326
7341
  type = this.safeString(accountsByType, fromAccount);
7327
7342
  const currency = this.currency(code);
7328
7343
  let request = {
7329
- 'coin': currency['code'],
7344
+ 'coin': currency['id'],
7330
7345
  'fromType': type,
7331
7346
  };
7332
7347
  if (since !== undefined) {
@@ -7385,7 +7400,7 @@ class bitget extends bitget$1 {
7385
7400
  'fromType': fromType,
7386
7401
  'toType': toType,
7387
7402
  'amount': amount,
7388
- 'coin': currency['code'],
7403
+ 'coin': currency['id'],
7389
7404
  };
7390
7405
  const symbol = this.safeString(params, 'symbol');
7391
7406
  params = this.omit(params, 'symbol');
@@ -7572,7 +7587,7 @@ class bitget extends bitget$1 {
7572
7587
  await this.loadMarkets();
7573
7588
  const currency = this.currency(code);
7574
7589
  const request = {
7575
- 'coin': currency['code'],
7590
+ 'coin': currency['id'],
7576
7591
  'borrowAmount': this.currencyToPrecision(code, amount),
7577
7592
  };
7578
7593
  const response = await this.privateMarginPostV2MarginCrossedAccountBorrow(this.extend(request, params));
@@ -7607,7 +7622,7 @@ class bitget extends bitget$1 {
7607
7622
  const currency = this.currency(code);
7608
7623
  const market = this.market(symbol);
7609
7624
  const request = {
7610
- 'coin': currency['code'],
7625
+ 'coin': currency['id'],
7611
7626
  'borrowAmount': this.currencyToPrecision(code, amount),
7612
7627
  'symbol': market['id'],
7613
7628
  };
@@ -7644,7 +7659,7 @@ class bitget extends bitget$1 {
7644
7659
  const currency = this.currency(code);
7645
7660
  const market = this.market(symbol);
7646
7661
  const request = {
7647
- 'coin': currency['code'],
7662
+ 'coin': currency['id'],
7648
7663
  'repayAmount': this.currencyToPrecision(code, amount),
7649
7664
  'symbol': market['id'],
7650
7665
  };
@@ -7680,7 +7695,7 @@ class bitget extends bitget$1 {
7680
7695
  await this.loadMarkets();
7681
7696
  const currency = this.currency(code);
7682
7697
  const request = {
7683
- 'coin': currency['code'],
7698
+ 'coin': currency['id'],
7684
7699
  'repayAmount': this.currencyToPrecision(code, amount),
7685
7700
  };
7686
7701
  const response = await this.privateMarginPostV2MarginCrossedAccountRepay(this.extend(request, params));
@@ -8042,7 +8057,7 @@ class bitget extends bitget$1 {
8042
8057
  await this.loadMarkets();
8043
8058
  const currency = this.currency(code);
8044
8059
  const request = {
8045
- 'coin': currency['code'],
8060
+ 'coin': currency['id'],
8046
8061
  };
8047
8062
  const response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
8048
8063
  //
@@ -8137,7 +8152,7 @@ class bitget extends bitget$1 {
8137
8152
  let currency = undefined;
8138
8153
  if (code !== undefined) {
8139
8154
  currency = this.currency(code);
8140
- request['coin'] = currency['code'];
8155
+ request['coin'] = currency['id'];
8141
8156
  }
8142
8157
  if (since !== undefined) {
8143
8158
  request['startTime'] = since;
@@ -756,6 +756,9 @@ class bitopro extends bitopro$1 {
756
756
  if (limit === undefined) {
757
757
  limit = 500;
758
758
  }
759
+ else {
760
+ limit = Math.min(limit, 75000); // supports slightly more than 75k candles atm, but limit here to avoid errors
761
+ }
759
762
  const timeframeInSeconds = this.parseTimeframe(timeframe);
760
763
  let alignedSince = undefined;
761
764
  if (since === undefined) {
@@ -1348,9 +1348,6 @@ class bitrue extends bitrue$1 {
1348
1348
  'interval': this.safeString(timeframesFuture, timeframe, '1min'),
1349
1349
  };
1350
1350
  if (limit !== undefined) {
1351
- if (limit > 300) {
1352
- limit = 300;
1353
- }
1354
1351
  request['limit'] = limit;
1355
1352
  }
1356
1353
  if (market['linear']) {
@@ -1369,9 +1366,6 @@ class bitrue extends bitrue$1 {
1369
1366
  'scale': this.safeString(timeframesSpot, timeframe, '1m'),
1370
1367
  };
1371
1368
  if (limit !== undefined) {
1372
- if (limit > 1440) {
1373
- limit = 1440;
1374
- }
1375
1369
  request['limit'] = limit;
1376
1370
  }
1377
1371
  if (since !== undefined) {
@@ -3043,13 +3037,25 @@ class bitrue extends bitrue$1 {
3043
3037
  return response;
3044
3038
  }
3045
3039
  parseMarginModification(data, market = undefined) {
3040
+ //
3041
+ // setMargin
3042
+ //
3043
+ // {
3044
+ // "code": 0,
3045
+ // "msg": "success"
3046
+ // "data": null
3047
+ // }
3048
+ //
3046
3049
  return {
3047
3050
  'info': data,
3051
+ 'symbol': market['symbol'],
3048
3052
  'type': undefined,
3049
3053
  'amount': undefined,
3054
+ 'total': undefined,
3050
3055
  'code': undefined,
3051
- 'symbol': market['symbol'],
3052
3056
  'status': undefined,
3057
+ 'timestamp': undefined,
3058
+ 'datetime': undefined,
3053
3059
  };
3054
3060
  }
3055
3061
  async setMargin(symbol, amount, params = {}) {
@@ -932,6 +932,9 @@ class bitvavo extends bitvavo$1 {
932
932
  if (limit === undefined) {
933
933
  limit = 1440;
934
934
  }
935
+ else {
936
+ limit = Math.min(limit, 1440);
937
+ }
935
938
  request['end'] = this.sum(since, limit * duration * 1000);
936
939
  }
937
940
  [request, params] = this.handleUntilOption('end', request, params);
@@ -538,7 +538,7 @@ class btcmarkets extends btcmarkets$1 {
538
538
  request['from'] = this.iso8601(since);
539
539
  }
540
540
  if (limit !== undefined) {
541
- request['limit'] = limit; // default is 10, max 200
541
+ request['limit'] = Math.min(limit, 200); // default is 10, max 200
542
542
  }
543
543
  const response = await this.publicGetMarketsMarketIdCandles(this.extend(request, params));
544
544
  //
@@ -585,6 +585,7 @@ class btcturk extends btcturk$1 {
585
585
  limit = 100; // default value
586
586
  }
587
587
  if (limit !== undefined) {
588
+ limit = Math.min(limit, 11000); // max 11000 candles diapason can be covered
588
589
  if (timeframe === '1y') { // difficult with leap years
589
590
  throw new errors.BadRequest(this.id + ' fetchOHLCV () does not accept a limit parameter when timeframe == "1y"');
590
591
  }
@@ -595,7 +596,7 @@ class btcturk extends btcturk$1 {
595
596
  request['to'] = Math.min(request['to'], to);
596
597
  }
597
598
  else {
598
- request['from'] = this.parseToInt(until / 1000) - limitSeconds;
599
+ request['from'] = this.parseToInt(0 / 1000) - limitSeconds;
599
600
  }
600
601
  }
601
602
  const response = await this.graphGetKlinesHistory(this.extend(request, params));