ccxt 4.2.85 → 4.2.87

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 (99) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.js +1132 -432
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +11 -1
  6. package/dist/cjs/src/binance.js +14 -1
  7. package/dist/cjs/src/bingx.js +71 -20
  8. package/dist/cjs/src/bitbank.js +19 -23
  9. package/dist/cjs/src/bitfinex.js +3 -0
  10. package/dist/cjs/src/bitfinex2.js +16 -1
  11. package/dist/cjs/src/bitflyer.js +19 -0
  12. package/dist/cjs/src/bitget.js +15 -1
  13. package/dist/cjs/src/bitopro.js +3 -0
  14. package/dist/cjs/src/bitrue.js +13 -7
  15. package/dist/cjs/src/bitvavo.js +3 -0
  16. package/dist/cjs/src/btcmarkets.js +1 -1
  17. package/dist/cjs/src/btcturk.js +2 -1
  18. package/dist/cjs/src/coinex.js +576 -302
  19. package/dist/cjs/src/currencycom.js +1 -1
  20. package/dist/cjs/src/delta.js +3 -1
  21. package/dist/cjs/src/digifinex.js +4 -2
  22. package/dist/cjs/src/exmo.js +11 -12
  23. package/dist/cjs/src/gate.js +5 -2
  24. package/dist/cjs/src/hitbtc.js +26 -2
  25. package/dist/cjs/src/htx.js +2 -2
  26. package/dist/cjs/src/huobijp.js +1 -1
  27. package/dist/cjs/src/hyperliquid.js +249 -12
  28. package/dist/cjs/src/idex.js +11 -12
  29. package/dist/cjs/src/krakenfutures.js +2 -6
  30. package/dist/cjs/src/lbank.js +3 -0
  31. package/dist/cjs/src/oceanex.js +1 -1
  32. package/dist/cjs/src/okcoin.js +3 -1
  33. package/dist/cjs/src/okx.js +24 -10
  34. package/dist/cjs/src/phemex.js +3 -1
  35. package/dist/cjs/src/pro/bitget.js +1 -0
  36. package/dist/cjs/src/pro/kucoin.js +11 -6
  37. package/dist/cjs/src/wazirx.js +1 -1
  38. package/dist/cjs/src/zonda.js +3 -0
  39. package/examples/js/benchmark.js +104 -0
  40. package/examples/ts/benchmark.ts +134 -0
  41. package/js/ccxt.d.ts +1 -1
  42. package/js/ccxt.js +1 -1
  43. package/js/src/abstract/coinex.d.ts +232 -123
  44. package/js/src/ascendex.d.ts +5 -12
  45. package/js/src/ascendex.js +11 -1
  46. package/js/src/base/Exchange.d.ts +13 -13
  47. package/js/src/base/types.d.ts +11 -0
  48. package/js/src/binance.d.ts +4 -11
  49. package/js/src/binance.js +14 -1
  50. package/js/src/bingx.d.ts +5 -2
  51. package/js/src/bingx.js +71 -20
  52. package/js/src/bitbank.js +19 -23
  53. package/js/src/bitfinex.js +3 -0
  54. package/js/src/bitfinex2.d.ts +3 -17
  55. package/js/src/bitfinex2.js +16 -1
  56. package/js/src/bitflyer.d.ts +1 -0
  57. package/js/src/bitflyer.js +20 -1
  58. package/js/src/bitget.d.ts +5 -12
  59. package/js/src/bitget.js +15 -1
  60. package/js/src/bitopro.js +3 -0
  61. package/js/src/bitrue.d.ts +3 -17
  62. package/js/src/bitrue.js +13 -7
  63. package/js/src/bitvavo.js +3 -0
  64. package/js/src/btcmarkets.js +1 -1
  65. package/js/src/btcturk.js +2 -1
  66. package/js/src/coinex.d.ts +5 -12
  67. package/js/src/coinex.js +576 -302
  68. package/js/src/currencycom.js +1 -1
  69. package/js/src/delta.d.ts +5 -37
  70. package/js/src/delta.js +3 -1
  71. package/js/src/digifinex.d.ts +5 -13
  72. package/js/src/digifinex.js +4 -2
  73. package/js/src/exmo.d.ts +5 -37
  74. package/js/src/exmo.js +11 -12
  75. package/js/src/gate.d.ts +5 -33
  76. package/js/src/gate.js +5 -2
  77. package/js/src/hitbtc.d.ts +5 -12
  78. package/js/src/hitbtc.js +26 -2
  79. package/js/src/htx.js +2 -2
  80. package/js/src/huobijp.js +1 -1
  81. package/js/src/hyperliquid.d.ts +7 -4
  82. package/js/src/hyperliquid.js +249 -12
  83. package/js/src/idex.js +11 -12
  84. package/js/src/krakenfutures.js +2 -6
  85. package/js/src/kucoinfutures.d.ts +2 -2
  86. package/js/src/lbank.js +3 -0
  87. package/js/src/mexc.d.ts +3 -3
  88. package/js/src/oceanex.js +1 -1
  89. package/js/src/okcoin.js +3 -1
  90. package/js/src/okx.d.ts +5 -33
  91. package/js/src/okx.js +24 -10
  92. package/js/src/phemex.d.ts +3 -11
  93. package/js/src/phemex.js +3 -1
  94. package/js/src/pro/bitget.js +1 -0
  95. package/js/src/pro/kucoin.js +11 -6
  96. package/js/src/wazirx.js +1 -1
  97. package/js/src/zonda.js +3 -0
  98. package/package.json +3 -2
  99. package/skip-tests.json +7 -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.85';
185
+ const version = '4.2.87';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -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 = {}) {
@@ -11212,6 +11212,16 @@ class binance extends binance$1 {
11212
11212
  });
11213
11213
  }
11214
11214
  parseMarginModification(data, market = undefined) {
11215
+ //
11216
+ // add/reduce margin
11217
+ //
11218
+ // {
11219
+ // "code": 200,
11220
+ // "msg": "Successfully modify position margin.",
11221
+ // "amount": 0.001,
11222
+ // "type": 1
11223
+ // }
11224
+ //
11215
11225
  const rawType = this.safeInteger(data, 'type');
11216
11226
  const resultType = (rawType === 1) ? 'add' : 'reduce';
11217
11227
  const resultAmount = this.safeNumber(data, 'amount');
@@ -11219,11 +11229,14 @@ class binance extends binance$1 {
11219
11229
  const status = (errorCode === '200') ? 'ok' : 'failed';
11220
11230
  return {
11221
11231
  'info': data,
11232
+ 'symbol': market['symbol'],
11222
11233
  'type': resultType,
11223
11234
  'amount': resultAmount,
11235
+ 'total': undefined,
11224
11236
  'code': undefined,
11225
- 'symbol': market['symbol'],
11226
11237
  'status': status,
11238
+ 'timestamp': undefined,
11239
+ 'datetime': undefined,
11227
11240
  };
11228
11241
  }
11229
11242
  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,
@@ -629,7 +631,7 @@ class bingx extends bingx$1 {
629
631
  symbol += ':' + settle;
630
632
  }
631
633
  const fees = this.safeDict(this.fees, type, {});
632
- const contractSize = this.safeNumber(market, 'size');
634
+ const contractSize = (swap) ? this.parseNumber('1') : undefined;
633
635
  const isActive = this.safeString(market, 'status') === '1';
634
636
  const isInverse = (spot) ? undefined : false;
635
637
  const isLinear = (spot) ? undefined : swap;
@@ -670,7 +672,7 @@ class bingx extends bingx$1 {
670
672
  'max': this.safeInteger(market, 'maxLongLeverage'),
671
673
  },
672
674
  'amount': {
673
- 'min': this.safeNumber(market, 'minQty'),
675
+ 'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
674
676
  'max': this.safeNumber(market, 'maxQty'),
675
677
  },
676
678
  'price': {
@@ -678,7 +680,7 @@ class bingx extends bingx$1 {
678
680
  'max': undefined,
679
681
  },
680
682
  'cost': {
681
- 'min': this.safeNumber(market, 'minNotional'),
683
+ 'min': this.safeNumber2(market, 'minNotional', 'tradeMinUSDT'),
682
684
  'max': this.safeNumber(market, 'maxNotional'),
683
685
  },
684
686
  },
@@ -1035,6 +1037,13 @@ class bingx extends bingx$1 {
1035
1037
  if (isMaker !== undefined) {
1036
1038
  takeOrMaker = isMaker ? 'maker' : 'taker';
1037
1039
  }
1040
+ let amount = this.safeStringN(trade, ['qty', 'amount', 'q']);
1041
+ if ((market !== undefined) && market['swap'] && ('volume' in trade)) {
1042
+ // private trade returns num of contracts instead of base currency (as the order-related methods do)
1043
+ const contractSize = this.safeString(market['info'], 'tradeMinQuantity');
1044
+ const volume = this.safeString(trade, 'volume');
1045
+ amount = Precise["default"].stringMul(volume, contractSize);
1046
+ }
1038
1047
  return this.safeTrade({
1039
1048
  'id': this.safeStringN(trade, ['id', 't']),
1040
1049
  'info': trade,
@@ -1046,7 +1055,7 @@ class bingx extends bingx$1 {
1046
1055
  'side': this.parseOrderSide(side),
1047
1056
  'takerOrMaker': takeOrMaker,
1048
1057
  'price': this.safeString2(trade, 'price', 'p'),
1049
- 'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
1058
+ 'amount': amount,
1050
1059
  'cost': cost,
1051
1060
  'fee': {
1052
1061
  'cost': this.parseNumber(Precise["default"].stringAbs(this.safeString2(trade, 'commission', 'n'))),
@@ -1678,19 +1687,27 @@ class bingx extends bingx$1 {
1678
1687
  }
1679
1688
  parsePosition(position, market = undefined) {
1680
1689
  //
1681
- // {
1682
- // "symbol": "BTC-USDT",
1683
- // "positionId": "12345678",
1684
- // "positionSide": "LONG",
1685
- // "isolated": true,
1686
- // "positionAmt": "123.33",
1687
- // "availableAmt": "128.99",
1688
- // "unrealizedProfit": "1.22",
1689
- // "realisedProfit": "8.1",
1690
- // "initialMargin": "123.33",
1691
- // "avgPrice": "2.2",
1692
- // "leverage": 10,
1693
- // }
1690
+ // {
1691
+ // "positionId":"1773122376147623936",
1692
+ // "symbol":"XRP-USDT",
1693
+ // "currency":"USDT",
1694
+ // "positionAmt":"3",
1695
+ // "availableAmt":"3",
1696
+ // "positionSide":"LONG",
1697
+ // "isolated":false,
1698
+ // "avgPrice":"0.6139",
1699
+ // "initialMargin":"0.0897",
1700
+ // "leverage":20,
1701
+ // "unrealizedProfit":"-0.0023",
1702
+ // "realisedProfit":"-0.0009",
1703
+ // "liquidationPrice":0,
1704
+ // "pnlRatio":"-0.0260",
1705
+ // "maxMarginReduction":"",
1706
+ // "riskRate":"",
1707
+ // "markPrice":"",
1708
+ // "positionValue":"",
1709
+ // "onlyOnePosition":false
1710
+ // }
1694
1711
  //
1695
1712
  // standard position
1696
1713
  //
@@ -1717,7 +1734,7 @@ class bingx extends bingx$1 {
1717
1734
  'info': position,
1718
1735
  'id': this.safeString(position, 'positionId'),
1719
1736
  'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
1720
- 'notional': this.safeNumber(position, 'positionAmt'),
1737
+ 'notional': this.safeNumber(position, 'positionValue'),
1721
1738
  'marginMode': marginMode,
1722
1739
  'liquidationPrice': undefined,
1723
1740
  'entryPrice': this.safeNumber2(position, 'avgPrice', 'entryPrice'),
@@ -1735,7 +1752,7 @@ class bingx extends bingx$1 {
1735
1752
  'lastUpdateTimestamp': undefined,
1736
1753
  'maintenanceMargin': undefined,
1737
1754
  'maintenanceMarginPercentage': undefined,
1738
- 'collateral': this.safeNumber(position, 'positionAmt'),
1755
+ 'collateral': undefined,
1739
1756
  'initialMargin': this.safeNumber(position, 'initialMargin'),
1740
1757
  'initialMarginPercentage': undefined,
1741
1758
  'leverage': this.safeNumber(position, 'leverage'),
@@ -3449,6 +3466,18 @@ class bingx extends bingx$1 {
3449
3466
  };
3450
3467
  return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
3451
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
+ }
3452
3481
  async setMargin(symbol, amount, params = {}) {
3453
3482
  /**
3454
3483
  * @method
@@ -3483,7 +3512,29 @@ class bingx extends bingx$1 {
3483
3512
  // "type": 1
3484
3513
  // }
3485
3514
  //
3486
- 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
+ };
3487
3538
  }
3488
3539
  async fetchLeverage(symbol, params = {}) {
3489
3540
  /**
@@ -138,21 +138,23 @@ class bitbank extends bitbank$1 {
138
138
  },
139
139
  'precisionMode': number.TICK_SIZE,
140
140
  'exceptions': {
141
- '20001': errors.AuthenticationError,
142
- '20002': errors.AuthenticationError,
143
- '20003': errors.AuthenticationError,
144
- '20005': errors.AuthenticationError,
145
- '20004': errors.InvalidNonce,
146
- '40020': errors.InvalidOrder,
147
- '40021': errors.InvalidOrder,
148
- '40025': errors.ExchangeError,
149
- '40013': errors.OrderNotFound,
150
- '40014': errors.OrderNotFound,
151
- '50008': errors.PermissionDenied,
152
- '50009': errors.OrderNotFound,
153
- '50010': errors.OrderNotFound,
154
- '60001': errors.InsufficientFunds,
155
- '60005': errors.InvalidOrder,
141
+ 'exact': {
142
+ '20001': errors.AuthenticationError,
143
+ '20002': errors.AuthenticationError,
144
+ '20003': errors.AuthenticationError,
145
+ '20005': errors.AuthenticationError,
146
+ '20004': errors.InvalidNonce,
147
+ '40020': errors.InvalidOrder,
148
+ '40021': errors.InvalidOrder,
149
+ '40025': errors.ExchangeError,
150
+ '40013': errors.OrderNotFound,
151
+ '40014': errors.OrderNotFound,
152
+ '50008': errors.PermissionDenied,
153
+ '50009': errors.OrderNotFound,
154
+ '50010': errors.OrderNotFound,
155
+ '60001': errors.InsufficientFunds,
156
+ '60005': errors.InvalidOrder,
157
+ },
156
158
  },
157
159
  });
158
160
  }
@@ -983,16 +985,10 @@ class bitbank extends bitbank$1 {
983
985
  '70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
984
986
  '70010': 'We are temporarily raising the minimum order quantity as the system load is now rising.',
985
987
  };
986
- const errorClasses = this.exceptions;
987
988
  const code = this.safeString(data, 'code');
988
989
  const message = this.safeString(errorMessages, code, 'Error');
989
- const ErrorClass = this.safeValue(errorClasses, code);
990
- if (ErrorClass !== undefined) {
991
- throw new errorClasses[code](message);
992
- }
993
- else {
994
- throw new errors.ExchangeError(this.id + ' ' + this.json(response));
995
- }
990
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, message);
991
+ throw new errors.ExchangeError(this.id + ' ' + this.json(response));
996
992
  }
997
993
  return undefined;
998
994
  }
@@ -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,
@@ -6960,15 +6961,28 @@ class bitget extends bitget$1 {
6960
6961
  });
6961
6962
  }
6962
6963
  parseMarginModification(data, market = undefined) {
6964
+ //
6965
+ // addMargin/reduceMargin
6966
+ //
6967
+ // {
6968
+ // "code": "00000",
6969
+ // "msg": "success",
6970
+ // "requestTime": 1700813444618,
6971
+ // "data": ""
6972
+ // }
6973
+ //
6963
6974
  const errorCode = this.safeString(data, 'code');
6964
6975
  const status = (errorCode === '00000') ? 'ok' : 'failed';
6965
6976
  return {
6966
6977
  'info': data,
6978
+ 'symbol': market['symbol'],
6967
6979
  'type': undefined,
6968
6980
  'amount': undefined,
6981
+ 'total': undefined,
6969
6982
  'code': market['settle'],
6970
- 'symbol': market['symbol'],
6971
6983
  'status': status,
6984
+ 'timestamp': undefined,
6985
+ 'datetime': undefined,
6972
6986
  };
6973
6987
  }
6974
6988
  async reduceMargin(symbol, amount, params = {}) {
@@ -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));