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/js/src/bingx.js CHANGED
@@ -33,6 +33,7 @@ export default class bingx extends Exchange {
33
33
  'swap': true,
34
34
  'future': false,
35
35
  'option': false,
36
+ 'addMargin': true,
36
37
  'cancelAllOrders': true,
37
38
  'cancelOrder': true,
38
39
  'cancelOrders': true,
@@ -79,6 +80,7 @@ export default class bingx extends Exchange {
79
80
  'fetchTrades': true,
80
81
  'fetchTransfers': true,
81
82
  'fetchWithdrawals': true,
83
+ 'reduceMargin': true,
82
84
  'setLeverage': true,
83
85
  'setMargin': true,
84
86
  'setMarginMode': true,
@@ -3467,6 +3469,18 @@ export default class bingx extends Exchange {
3467
3469
  };
3468
3470
  return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
3469
3471
  }
3472
+ async addMargin(symbol, amount, params = {}) {
3473
+ const request = {
3474
+ 'type': 1,
3475
+ };
3476
+ return await this.setMargin(symbol, amount, this.extend(request, params));
3477
+ }
3478
+ async reduceMargin(symbol, amount, params = {}) {
3479
+ const request = {
3480
+ 'type': 2,
3481
+ };
3482
+ return await this.setMargin(symbol, amount, this.extend(request, params));
3483
+ }
3470
3484
  async setMargin(symbol, amount, params = {}) {
3471
3485
  /**
3472
3486
  * @method
@@ -3501,7 +3515,29 @@ export default class bingx extends Exchange {
3501
3515
  // "type": 1
3502
3516
  // }
3503
3517
  //
3504
- return response;
3518
+ return this.parseMarginModification(response, market);
3519
+ }
3520
+ parseMarginModification(data, market = undefined) {
3521
+ //
3522
+ // {
3523
+ // "code": 0,
3524
+ // "msg": "",
3525
+ // "amount": 1,
3526
+ // "type": 1
3527
+ // }
3528
+ //
3529
+ const type = this.safeString(data, 'type');
3530
+ return {
3531
+ 'info': data,
3532
+ 'symbol': this.safeString(market, 'symbol'),
3533
+ 'type': (type === '1') ? 'add' : 'reduce',
3534
+ 'amount': this.safeNumber(data, 'amount'),
3535
+ 'total': this.safeNumber(data, 'margin'),
3536
+ 'code': this.safeString(market, 'settle'),
3537
+ 'status': undefined,
3538
+ 'timestamp': undefined,
3539
+ 'datetime': undefined,
3540
+ };
3505
3541
  }
3506
3542
  async fetchLeverage(symbol, params = {}) {
3507
3543
  /**
@@ -1326,6 +1326,9 @@ export default class bitfinex extends Exchange {
1326
1326
  if (limit === undefined) {
1327
1327
  limit = 100;
1328
1328
  }
1329
+ else {
1330
+ limit = Math.min(limit, 10000);
1331
+ }
1329
1332
  const market = this.market(symbol);
1330
1333
  const v2id = 't' + market['id'];
1331
1334
  const request = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitfinex2.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification } from './base/types.js';
3
3
  /**
4
4
  * @class bitfinex2
5
5
  * @augments Exchange
@@ -154,22 +154,8 @@ export default class bitfinex2 extends Exchange {
154
154
  parseOpenInterest(interest: any, market?: Market): OpenInterest;
155
155
  fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
156
156
  parseLiquidation(liquidation: any, market?: Market): Liquidation;
157
- setMargin(symbol: string, amount: number, params?: {}): Promise<{
158
- info: any;
159
- type: any;
160
- amount: any;
161
- code: any;
162
- symbol: any;
163
- status: string;
164
- }>;
165
- parseMarginModification(data: any, market?: any): {
166
- info: any;
167
- type: any;
168
- amount: any;
169
- code: any;
170
- symbol: any;
171
- status: string;
172
- };
157
+ setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
158
+ parseMarginModification(data: any, market?: any): MarginModification;
173
159
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
174
160
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
175
161
  }
@@ -1383,6 +1383,9 @@ export default class bitfinex2 extends Exchange {
1383
1383
  if (limit === undefined) {
1384
1384
  limit = 10000;
1385
1385
  }
1386
+ else {
1387
+ limit = Math.min(limit, 10000);
1388
+ }
1386
1389
  let request = {
1387
1390
  'symbol': market['id'],
1388
1391
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
@@ -3504,15 +3507,27 @@ export default class bitfinex2 extends Exchange {
3504
3507
  return this.parseMarginModification(data, market);
3505
3508
  }
3506
3509
  parseMarginModification(data, market = undefined) {
3510
+ //
3511
+ // setMargin
3512
+ //
3513
+ // [
3514
+ // [
3515
+ // 1
3516
+ // ]
3517
+ // ]
3518
+ //
3507
3519
  const marginStatusRaw = data[0];
3508
3520
  const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
3509
3521
  return {
3510
3522
  'info': data,
3523
+ 'symbol': market['symbol'],
3511
3524
  'type': undefined,
3512
3525
  'amount': undefined,
3526
+ 'total': undefined,
3513
3527
  'code': undefined,
3514
- 'symbol': market['symbol'],
3515
3528
  'status': marginStatus,
3529
+ 'timestamp': undefined,
3530
+ 'datetime': undefined,
3516
3531
  };
3517
3532
  }
3518
3533
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -44,4 +44,5 @@ export default class bitflyer extends Exchange {
44
44
  body: any;
45
45
  headers: any;
46
46
  };
47
+ handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
47
48
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bitflyer.js';
9
- import { ExchangeError, ArgumentsRequired, OrderNotFound } from './base/errors.js';
9
+ import { ExchangeError, ArgumentsRequired, OrderNotFound, OnMaintenance } from './base/errors.js';
10
10
  import { TICK_SIZE } from './base/functions/number.js';
11
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
12
12
  import { Precise } from './base/Precise.js';
@@ -117,6 +117,11 @@ export default class bitflyer extends Exchange {
117
117
  },
118
118
  },
119
119
  'precisionMode': TICK_SIZE,
120
+ 'exceptions': {
121
+ 'exact': {
122
+ '-2': OnMaintenance, // {"status":-2,"error_message":"Under maintenance","data":null}
123
+ },
124
+ },
120
125
  });
121
126
  }
122
127
  parseExpiryDate(expiry) {
@@ -1044,4 +1049,18 @@ export default class bitflyer extends Exchange {
1044
1049
  }
1045
1050
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
1046
1051
  }
1052
+ handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1053
+ if (response === undefined) {
1054
+ return undefined; // fallback to the default error handler
1055
+ }
1056
+ const feedback = this.id + ' ' + body;
1057
+ // i.e. {"status":-2,"error_message":"Under maintenance","data":null}
1058
+ const errorMessage = this.safeString(response, 'error_message');
1059
+ const statusCode = this.safeNumber(response, 'status');
1060
+ if (errorMessage !== undefined) {
1061
+ this.throwExactlyMatchedException(this.exceptions['exact'], statusCode, feedback);
1062
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
1063
+ }
1064
+ return undefined;
1065
+ }
1047
1066
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitget.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num, MarginModification } from './base/types.js';
3
3
  /**
4
4
  * @class bitget
5
5
  * @augments Exchange
@@ -146,17 +146,10 @@ export default class bitget extends Exchange {
146
146
  id: string;
147
147
  };
148
148
  parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
149
- modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<any>;
150
- parseMarginModification(data: any, market?: Market): {
151
- info: any;
152
- type: any;
153
- amount: any;
154
- code: string;
155
- symbol: string;
156
- status: string;
157
- };
158
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<any>;
159
- addMargin(symbol: string, amount: any, params?: {}): Promise<any>;
149
+ modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
150
+ parseMarginModification(data: any, market?: Market): MarginModification;
151
+ reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
152
+ addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
160
153
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
161
154
  parseLeverage(leverage: any, market?: any): Leverage;
162
155
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
package/js/src/bitget.js CHANGED
@@ -1222,6 +1222,7 @@ export default class bitget extends Exchange {
1222
1222
  '40768': OrderNotFound,
1223
1223
  '41114': OnMaintenance,
1224
1224
  '43011': InvalidOrder,
1225
+ '43012': InsufficientFunds,
1225
1226
  '43025': InvalidOrder,
1226
1227
  '43115': OnMaintenance,
1227
1228
  '45110': InvalidOrder,
@@ -1297,6 +1298,7 @@ export default class bitget extends Exchange {
1297
1298
  'commonCurrencies': {
1298
1299
  'JADE': 'Jade Protocol',
1299
1300
  'DEGEN': 'DegenReborn',
1301
+ 'TONCOIN': 'TON',
1300
1302
  },
1301
1303
  'options': {
1302
1304
  'timeframes': {
@@ -1876,8 +1878,8 @@ export default class bitget extends Exchange {
1876
1878
  const data = this.safeValue(response, 'data', []);
1877
1879
  for (let i = 0; i < data.length; i++) {
1878
1880
  const entry = data[i];
1879
- const id = this.safeString(entry, 'coinId');
1880
- const code = this.safeCurrencyCode(this.safeString(entry, 'coin'));
1881
+ 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..)
1882
+ const code = this.safeCurrencyCode(id);
1881
1883
  const chains = this.safeValue(entry, 'chains', []);
1882
1884
  const networks = {};
1883
1885
  let deposit = false;
@@ -2006,7 +2008,7 @@ export default class bitget extends Exchange {
2006
2008
  }
2007
2009
  params = this.omit(params, 'code');
2008
2010
  const currency = this.currency(code);
2009
- request['coin'] = currency['code'];
2011
+ request['coin'] = currency['id'];
2010
2012
  response = await this.privateMarginGetV2MarginCrossedTierData(this.extend(request, params));
2011
2013
  }
2012
2014
  else {
@@ -2162,7 +2164,7 @@ export default class bitget extends Exchange {
2162
2164
  since = this.milliseconds() - 7776000000; // 90 days
2163
2165
  }
2164
2166
  let request = {
2165
- 'coin': currency['code'],
2167
+ 'coin': currency['id'],
2166
2168
  'startTime': since,
2167
2169
  'endTime': this.milliseconds(),
2168
2170
  };
@@ -2221,7 +2223,7 @@ export default class bitget extends Exchange {
2221
2223
  const currency = this.currency(code);
2222
2224
  const networkId = this.networkCodeToId(chain);
2223
2225
  const request = {
2224
- 'coin': currency['code'],
2226
+ 'coin': currency['id'],
2225
2227
  'address': address,
2226
2228
  'chain': networkId,
2227
2229
  'size': amount,
@@ -2307,7 +2309,7 @@ export default class bitget extends Exchange {
2307
2309
  since = this.milliseconds() - 7776000000; // 90 days
2308
2310
  }
2309
2311
  let request = {
2310
- 'coin': currency['code'],
2312
+ 'coin': currency['id'],
2311
2313
  'startTime': since,
2312
2314
  'endTime': this.milliseconds(),
2313
2315
  };
@@ -2450,7 +2452,7 @@ export default class bitget extends Exchange {
2450
2452
  }
2451
2453
  const currency = this.currency(code);
2452
2454
  const request = {
2453
- 'coin': currency['code'],
2455
+ 'coin': currency['id'],
2454
2456
  };
2455
2457
  if (networkId !== undefined) {
2456
2458
  request['chain'] = networkId;
@@ -5903,7 +5905,7 @@ export default class bitget extends Exchange {
5903
5905
  let request = {};
5904
5906
  if (code !== undefined) {
5905
5907
  currency = this.currency(code);
5906
- request['coin'] = currency['code'];
5908
+ request['coin'] = currency['id'];
5907
5909
  }
5908
5910
  [request, params] = this.handleUntilOption('endTime', request, params);
5909
5911
  if (since !== undefined) {
@@ -6963,15 +6965,28 @@ export default class bitget extends Exchange {
6963
6965
  });
6964
6966
  }
6965
6967
  parseMarginModification(data, market = undefined) {
6968
+ //
6969
+ // addMargin/reduceMargin
6970
+ //
6971
+ // {
6972
+ // "code": "00000",
6973
+ // "msg": "success",
6974
+ // "requestTime": 1700813444618,
6975
+ // "data": ""
6976
+ // }
6977
+ //
6966
6978
  const errorCode = this.safeString(data, 'code');
6967
6979
  const status = (errorCode === '00000') ? 'ok' : 'failed';
6968
6980
  return {
6969
6981
  'info': data,
6982
+ 'symbol': market['symbol'],
6970
6983
  'type': undefined,
6971
6984
  'amount': undefined,
6985
+ 'total': undefined,
6972
6986
  'code': market['settle'],
6973
- 'symbol': market['symbol'],
6974
6987
  'status': status,
6988
+ 'timestamp': undefined,
6989
+ 'datetime': undefined,
6975
6990
  };
6976
6991
  }
6977
6992
  async reduceMargin(symbol, amount, params = {}) {
@@ -7329,7 +7344,7 @@ export default class bitget extends Exchange {
7329
7344
  type = this.safeString(accountsByType, fromAccount);
7330
7345
  const currency = this.currency(code);
7331
7346
  let request = {
7332
- 'coin': currency['code'],
7347
+ 'coin': currency['id'],
7333
7348
  'fromType': type,
7334
7349
  };
7335
7350
  if (since !== undefined) {
@@ -7388,7 +7403,7 @@ export default class bitget extends Exchange {
7388
7403
  'fromType': fromType,
7389
7404
  'toType': toType,
7390
7405
  'amount': amount,
7391
- 'coin': currency['code'],
7406
+ 'coin': currency['id'],
7392
7407
  };
7393
7408
  const symbol = this.safeString(params, 'symbol');
7394
7409
  params = this.omit(params, 'symbol');
@@ -7575,7 +7590,7 @@ export default class bitget extends Exchange {
7575
7590
  await this.loadMarkets();
7576
7591
  const currency = this.currency(code);
7577
7592
  const request = {
7578
- 'coin': currency['code'],
7593
+ 'coin': currency['id'],
7579
7594
  'borrowAmount': this.currencyToPrecision(code, amount),
7580
7595
  };
7581
7596
  const response = await this.privateMarginPostV2MarginCrossedAccountBorrow(this.extend(request, params));
@@ -7610,7 +7625,7 @@ export default class bitget extends Exchange {
7610
7625
  const currency = this.currency(code);
7611
7626
  const market = this.market(symbol);
7612
7627
  const request = {
7613
- 'coin': currency['code'],
7628
+ 'coin': currency['id'],
7614
7629
  'borrowAmount': this.currencyToPrecision(code, amount),
7615
7630
  'symbol': market['id'],
7616
7631
  };
@@ -7647,7 +7662,7 @@ export default class bitget extends Exchange {
7647
7662
  const currency = this.currency(code);
7648
7663
  const market = this.market(symbol);
7649
7664
  const request = {
7650
- 'coin': currency['code'],
7665
+ 'coin': currency['id'],
7651
7666
  'repayAmount': this.currencyToPrecision(code, amount),
7652
7667
  'symbol': market['id'],
7653
7668
  };
@@ -7683,7 +7698,7 @@ export default class bitget extends Exchange {
7683
7698
  await this.loadMarkets();
7684
7699
  const currency = this.currency(code);
7685
7700
  const request = {
7686
- 'coin': currency['code'],
7701
+ 'coin': currency['id'],
7687
7702
  'repayAmount': this.currencyToPrecision(code, amount),
7688
7703
  };
7689
7704
  const response = await this.privateMarginPostV2MarginCrossedAccountRepay(this.extend(request, params));
@@ -8045,7 +8060,7 @@ export default class bitget extends Exchange {
8045
8060
  await this.loadMarkets();
8046
8061
  const currency = this.currency(code);
8047
8062
  const request = {
8048
- 'coin': currency['code'],
8063
+ 'coin': currency['id'],
8049
8064
  };
8050
8065
  const response = await this.privateMarginGetV2MarginCrossedInterestRateAndLimit(this.extend(request, params));
8051
8066
  //
@@ -8140,7 +8155,7 @@ export default class bitget extends Exchange {
8140
8155
  let currency = undefined;
8141
8156
  if (code !== undefined) {
8142
8157
  currency = this.currency(code);
8143
- request['coin'] = currency['code'];
8158
+ request['coin'] = currency['id'];
8144
8159
  }
8145
8160
  if (since !== undefined) {
8146
8161
  request['startTime'] = since;
package/js/src/bitopro.js CHANGED
@@ -759,6 +759,9 @@ export default class bitopro extends Exchange {
759
759
  if (limit === undefined) {
760
760
  limit = 500;
761
761
  }
762
+ else {
763
+ limit = Math.min(limit, 75000); // supports slightly more than 75k candles atm, but limit here to avoid errors
764
+ }
762
765
  const timeframeInSeconds = this.parseTimeframe(timeframe);
763
766
  let alignedSince = undefined;
764
767
  if (since === undefined) {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitrue.js';
2
- import type { Balances, Currency, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry } from './base/types.js';
2
+ import type { Balances, Currency, Int, MarginModification, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitrue
5
5
  * @augments Exchange
@@ -73,22 +73,8 @@ export default class bitrue extends Exchange {
73
73
  fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
74
74
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
75
75
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
76
- parseMarginModification(data: any, market?: any): {
77
- info: any;
78
- type: any;
79
- amount: any;
80
- code: any;
81
- symbol: any;
82
- status: any;
83
- };
84
- setMargin(symbol: string, amount: number, params?: {}): Promise<{
85
- info: any;
86
- type: any;
87
- amount: any;
88
- code: any;
89
- symbol: any;
90
- status: any;
91
- }>;
76
+ parseMarginModification(data: any, market?: any): MarginModification;
77
+ setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
92
78
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
93
79
  url: any;
94
80
  method: string;
package/js/src/bitrue.js CHANGED
@@ -1351,9 +1351,6 @@ export default class bitrue extends Exchange {
1351
1351
  'interval': this.safeString(timeframesFuture, timeframe, '1min'),
1352
1352
  };
1353
1353
  if (limit !== undefined) {
1354
- if (limit > 300) {
1355
- limit = 300;
1356
- }
1357
1354
  request['limit'] = limit;
1358
1355
  }
1359
1356
  if (market['linear']) {
@@ -1372,9 +1369,6 @@ export default class bitrue extends Exchange {
1372
1369
  'scale': this.safeString(timeframesSpot, timeframe, '1m'),
1373
1370
  };
1374
1371
  if (limit !== undefined) {
1375
- if (limit > 1440) {
1376
- limit = 1440;
1377
- }
1378
1372
  request['limit'] = limit;
1379
1373
  }
1380
1374
  if (since !== undefined) {
@@ -3046,13 +3040,25 @@ export default class bitrue extends Exchange {
3046
3040
  return response;
3047
3041
  }
3048
3042
  parseMarginModification(data, market = undefined) {
3043
+ //
3044
+ // setMargin
3045
+ //
3046
+ // {
3047
+ // "code": 0,
3048
+ // "msg": "success"
3049
+ // "data": null
3050
+ // }
3051
+ //
3049
3052
  return {
3050
3053
  'info': data,
3054
+ 'symbol': market['symbol'],
3051
3055
  'type': undefined,
3052
3056
  'amount': undefined,
3057
+ 'total': undefined,
3053
3058
  'code': undefined,
3054
- 'symbol': market['symbol'],
3055
3059
  'status': undefined,
3060
+ 'timestamp': undefined,
3061
+ 'datetime': undefined,
3056
3062
  };
3057
3063
  }
3058
3064
  async setMargin(symbol, amount, params = {}) {
package/js/src/bitvavo.js CHANGED
@@ -935,6 +935,9 @@ export default class bitvavo extends Exchange {
935
935
  if (limit === undefined) {
936
936
  limit = 1440;
937
937
  }
938
+ else {
939
+ limit = Math.min(limit, 1440);
940
+ }
938
941
  request['end'] = this.sum(since, limit * duration * 1000);
939
942
  }
940
943
  [request, params] = this.handleUntilOption('end', request, params);
@@ -541,7 +541,7 @@ export default class btcmarkets extends Exchange {
541
541
  request['from'] = this.iso8601(since);
542
542
  }
543
543
  if (limit !== undefined) {
544
- request['limit'] = limit; // default is 10, max 200
544
+ request['limit'] = Math.min(limit, 200); // default is 10, max 200
545
545
  }
546
546
  const response = await this.publicGetMarketsMarketIdCandles(this.extend(request, params));
547
547
  //
package/js/src/btcturk.js CHANGED
@@ -588,6 +588,7 @@ export default class btcturk extends Exchange {
588
588
  limit = 100; // default value
589
589
  }
590
590
  if (limit !== undefined) {
591
+ limit = Math.min(limit, 11000); // max 11000 candles diapason can be covered
591
592
  if (timeframe === '1y') { // difficult with leap years
592
593
  throw new BadRequest(this.id + ' fetchOHLCV () does not accept a limit parameter when timeframe == "1y"');
593
594
  }
@@ -598,7 +599,7 @@ export default class btcturk extends Exchange {
598
599
  request['to'] = Math.min(request['to'], to);
599
600
  }
600
601
  else {
601
- request['from'] = this.parseToInt(until / 1000) - limitSeconds;
602
+ request['from'] = this.parseToInt(0 / 1000) - limitSeconds;
602
603
  }
603
604
  }
604
605
  const response = await this.graphGetKlinesHistory(this.extend(request, params));
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinex.js';
2
- import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num } from './base/types.js';
2
+ import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num, MarginModification } from './base/types.js';
3
3
  /**
4
4
  * @class coinex
5
5
  * @augments Exchange
@@ -88,16 +88,9 @@ export default class coinex extends Exchange {
88
88
  parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
89
89
  parseMarketLeverageTiers(item: any, market?: Market): any[];
90
90
  modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
91
- parseMarginModification(data: any, market?: Market): {
92
- info: any;
93
- type: any;
94
- amount: any;
95
- code: string;
96
- symbol: string;
97
- status: any;
98
- };
99
- addMargin(symbol: string, amount: any, params?: {}): Promise<any>;
100
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<any>;
91
+ parseMarginModification(data: any, market?: Market): MarginModification;
92
+ addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
93
+ reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
101
94
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
102
95
  fetchFundingRate(symbol: string, params?: {}): Promise<{
103
96
  info: any;