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
@@ -1065,19 +1065,22 @@ class coinex extends coinex$1 {
1065
1065
  * @method
1066
1066
  * @name coinex#fetchTime
1067
1067
  * @description fetches the current integer timestamp in milliseconds from the exchange server
1068
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
1068
+ * @see https://docs.coinex.com/api/v2/common/http/time
1069
1069
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1070
1070
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
1071
1071
  */
1072
- const response = await this.v1PerpetualPublicGetTime(params);
1072
+ const response = await this.v2PublicGetTime(params);
1073
1073
  //
1074
1074
  // {
1075
- // "code": "0",
1076
- // "data": "1653261274414",
1075
+ // "code": 0,
1076
+ // "data": {
1077
+ // "timestamp": 1711699867777
1078
+ // },
1077
1079
  // "message": "OK"
1078
1080
  // }
1079
1081
  //
1080
- return this.safeInteger(response, 'data');
1082
+ const data = this.safeDict(response, 'data', {});
1083
+ return this.safeInteger(data, 'timestamp');
1081
1084
  }
1082
1085
  async fetchOrderBook(symbol, limit = 20, params = {}) {
1083
1086
  /**
@@ -1337,7 +1340,8 @@ class coinex extends coinex$1 {
1337
1340
  * @method
1338
1341
  * @name coinex#fetchTradingFee
1339
1342
  * @description fetch the trading fees for a market
1340
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
1343
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
1344
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
1341
1345
  * @param {string} symbol unified market symbol
1342
1346
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1343
1347
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -1347,67 +1351,132 @@ class coinex extends coinex$1 {
1347
1351
  const request = {
1348
1352
  'market': market['id'],
1349
1353
  };
1350
- const response = await this.v1PublicGetMarketDetail(this.extend(request, params));
1351
- //
1352
- // {
1353
- // "code": 0,
1354
- // "data": {
1355
- // "name": "BTCUSDC",
1356
- // "min_amount": "0.0005",
1357
- // "maker_fee_rate": "0.002",
1358
- // "taker_fee_rate": "0.002",
1359
- // "pricing_name": "USDC",
1360
- // "pricing_decimal": 2,
1361
- // "trading_name": "BTC",
1362
- // "trading_decimal": 8
1363
- // },
1364
- // "message": "OK"
1365
- // }
1366
- //
1367
- const data = this.safeValue(response, 'data', {});
1368
- return this.parseTradingFee(data, market);
1354
+ let response = undefined;
1355
+ if (market['spot']) {
1356
+ response = await this.v2PublicGetSpotMarket(this.extend(request, params));
1357
+ //
1358
+ // {
1359
+ // "code": 0,
1360
+ // "data": [
1361
+ // {
1362
+ // "base_ccy": "BTC",
1363
+ // "base_ccy_precision": 8,
1364
+ // "is_amm_available": false,
1365
+ // "is_margin_available": true,
1366
+ // "maker_fee_rate": "0.002",
1367
+ // "market": "BTCUSDT",
1368
+ // "min_amount": "0.0001",
1369
+ // "quote_ccy": "USDT",
1370
+ // "quote_ccy_precision": 2,
1371
+ // "taker_fee_rate": "0.002"
1372
+ // }
1373
+ // ],
1374
+ // "message": "OK"
1375
+ // }
1376
+ //
1377
+ }
1378
+ else {
1379
+ response = await this.v2PublicGetFuturesMarket(this.extend(request, params));
1380
+ //
1381
+ // {
1382
+ // "code": 0,
1383
+ // "data": [
1384
+ // {
1385
+ // "base_ccy": "BTC",
1386
+ // "base_ccy_precision": 8,
1387
+ // "contract_type": "linear",
1388
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
1389
+ // "maker_fee_rate": "0",
1390
+ // "market": "BTCUSDT",
1391
+ // "min_amount": "0.0001",
1392
+ // "open_interest_volume": "185.7498",
1393
+ // "quote_ccy": "USDT",
1394
+ // "quote_ccy_precision": 2,
1395
+ // "taker_fee_rate": "0"
1396
+ // }
1397
+ // ],
1398
+ // "message": "OK"
1399
+ // }
1400
+ //
1401
+ }
1402
+ const data = this.safeList(response, 'data', []);
1403
+ const result = this.safeDict(data, 0, {});
1404
+ return this.parseTradingFee(result, market);
1369
1405
  }
1370
1406
  async fetchTradingFees(params = {}) {
1371
1407
  /**
1372
1408
  * @method
1373
1409
  * @name coinex#fetchTradingFees
1374
1410
  * @description fetch the trading fees for multiple markets
1375
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
1411
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market
1412
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market
1376
1413
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1377
1414
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1378
1415
  */
1379
1416
  await this.loadMarkets();
1380
- const response = await this.v1PublicGetMarketInfo(params);
1381
- //
1382
- // {
1383
- // "code": 0,
1384
- // "data": {
1385
- // "WAVESBTC": {
1386
- // "name": "WAVESBTC",
1387
- // "min_amount": "1",
1388
- // "maker_fee_rate": "0.001",
1389
- // "taker_fee_rate": "0.001",
1390
- // "pricing_name": "BTC",
1391
- // "pricing_decimal": 8,
1392
- // "trading_name": "WAVES",
1393
- // "trading_decimal": 8
1394
- // }
1395
- // ...
1396
- // }
1397
- // }
1398
- //
1399
- const data = this.safeValue(response, 'data', {});
1417
+ let type = undefined;
1418
+ [type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
1419
+ let response = undefined;
1420
+ if (type === 'swap') {
1421
+ response = await this.v2PublicGetFuturesMarket(params);
1422
+ //
1423
+ // {
1424
+ // "code": 0,
1425
+ // "data": [
1426
+ // {
1427
+ // "base_ccy": "BTC",
1428
+ // "base_ccy_precision": 8,
1429
+ // "contract_type": "linear",
1430
+ // "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
1431
+ // "maker_fee_rate": "0",
1432
+ // "market": "BTCUSDT",
1433
+ // "min_amount": "0.0001",
1434
+ // "open_interest_volume": "185.7498",
1435
+ // "quote_ccy": "USDT",
1436
+ // "quote_ccy_precision": 2,
1437
+ // "taker_fee_rate": "0"
1438
+ // }
1439
+ // ],
1440
+ // "message": "OK"
1441
+ // }
1442
+ //
1443
+ }
1444
+ else {
1445
+ response = await this.v2PublicGetSpotMarket(params);
1446
+ //
1447
+ // {
1448
+ // "code": 0,
1449
+ // "data": [
1450
+ // {
1451
+ // "base_ccy": "BTC",
1452
+ // "base_ccy_precision": 8,
1453
+ // "is_amm_available": false,
1454
+ // "is_margin_available": true,
1455
+ // "maker_fee_rate": "0.002",
1456
+ // "market": "BTCUSDT",
1457
+ // "min_amount": "0.0001",
1458
+ // "quote_ccy": "USDT",
1459
+ // "quote_ccy_precision": 2,
1460
+ // "taker_fee_rate": "0.002"
1461
+ // },
1462
+ // ],
1463
+ // "message": "OK"
1464
+ // }
1465
+ //
1466
+ }
1467
+ const data = this.safeList(response, 'data', []);
1400
1468
  const result = {};
1401
- for (let i = 0; i < this.symbols.length; i++) {
1402
- const symbol = this.symbols[i];
1403
- const market = this.market(symbol);
1404
- const fee = this.safeValue(data, market['id'], {});
1405
- result[symbol] = this.parseTradingFee(fee, market);
1469
+ for (let i = 0; i < data.length; i++) {
1470
+ const entry = data[i];
1471
+ const marketId = this.safeString(entry, 'market');
1472
+ const market = this.safeMarket(marketId, undefined, undefined, type);
1473
+ const symbol = market['symbol'];
1474
+ result[symbol] = this.parseTradingFee(entry, market);
1406
1475
  }
1407
1476
  return result;
1408
1477
  }
1409
1478
  parseTradingFee(fee, market = undefined) {
1410
- const marketId = this.safeValue(fee, 'name');
1479
+ const marketId = this.safeValue(fee, 'market');
1411
1480
  const symbol = this.safeSymbol(marketId, market);
1412
1481
  return {
1413
1482
  'info': fee,
@@ -4179,13 +4248,72 @@ class coinex extends coinex$1 {
4179
4248
  });
4180
4249
  }
4181
4250
  parseMarginModification(data, market = undefined) {
4251
+ //
4252
+ // addMargin/reduceMargin
4253
+ //
4254
+ // {
4255
+ // "adl_sort": 1,
4256
+ // "adl_sort_val": "0.00004320",
4257
+ // "amount": "0.0005",
4258
+ // "amount_max": "0.0005",
4259
+ // "amount_max_margin": "6.57352000000000000000",
4260
+ // "bkr_price": "16294.08000000000000011090",
4261
+ // "bkr_price_imply": "0.00000000000000000000",
4262
+ // "close_left": "0.0005",
4263
+ // "create_time": 1651202571.320778,
4264
+ // "deal_all": "19.72000000000000000000",
4265
+ // "deal_asset_fee": "0.00000000000000000000",
4266
+ // "fee_asset": "",
4267
+ // "finish_type": 1,
4268
+ // "first_price": "39441.12",
4269
+ // "insurance": "0.00000000000000000000",
4270
+ // "latest_price": "39441.12",
4271
+ // "leverage": "3",
4272
+ // "liq_amount": "0.00000000000000000000",
4273
+ // "liq_order_price": "0",
4274
+ // "liq_order_time": 0,
4275
+ // "liq_price": "16491.28560000000000011090",
4276
+ // "liq_price_imply": "0.00000000000000000000",
4277
+ // "liq_profit": "0.00000000000000000000",
4278
+ // "liq_time": 0,
4279
+ // "mainten_margin": "0.005",
4280
+ // "mainten_margin_amount": "0.09860280000000000000",
4281
+ // "maker_fee": "0.00000000000000000000",
4282
+ // "margin_amount": "11.57352000000000000000",
4283
+ // "market": "BTCUSDT",
4284
+ // "open_margin": "0.58687582908396110455",
4285
+ // "open_margin_imply": "0.00000000000000000000",
4286
+ // "open_price": "39441.12000000000000000000",
4287
+ // "open_val": "19.72056000000000000000",
4288
+ // "open_val_max": "19.72056000000000000000",
4289
+ // "position_id": 65171206,
4290
+ // "profit_clearing": "-0.00986028000000000000",
4291
+ // "profit_real": "-0.00986028000000000000",
4292
+ // "profit_unreal": "0.00",
4293
+ // "side": 2,
4294
+ // "stop_loss_price": "0.00000000000000000000",
4295
+ // "stop_loss_type": 0,
4296
+ // "sys": 0,
4297
+ // "take_profit_price": "0.00000000000000000000",
4298
+ // "take_profit_type": 0,
4299
+ // "taker_fee": "0.00000000000000000000",
4300
+ // "total": 3464,
4301
+ // "type": 1,
4302
+ // "update_time": 1651202638.911212,
4303
+ // "user_id": 3620173
4304
+ // }
4305
+ //
4306
+ const timestamp = this.safeIntegerProduct(data, 'update_time', 1000);
4182
4307
  return {
4183
4308
  'info': data,
4309
+ 'symbol': this.safeSymbol(undefined, market),
4184
4310
  'type': undefined,
4185
- 'amount': undefined,
4311
+ 'amount': this.safeNumber(data, 'margin_amount'),
4312
+ 'total': undefined,
4186
4313
  'code': market['quote'],
4187
- 'symbol': this.safeSymbol(undefined, market),
4188
4314
  'status': undefined,
4315
+ 'timestamp': timestamp,
4316
+ 'datetime': this.iso8601(timestamp),
4189
4317
  };
4190
4318
  }
4191
4319
  async addMargin(symbol, amount, params = {}) {
@@ -2755,7 +2755,7 @@ class cryptocom extends cryptocom$1 {
2755
2755
  //
2756
2756
  const result = this.safeDict(response, 'result', {});
2757
2757
  const data = this.safeList(result, 'data', []);
2758
- return this.parsePosition(data[0], market);
2758
+ return this.parsePosition(this.safeDict(data, 0), market);
2759
2759
  }
2760
2760
  async fetchPositions(symbols = undefined, params = {}) {
2761
2761
  /**
@@ -985,7 +985,7 @@ class currencycom extends currencycom$1 {
985
985
  request['startTime'] = since;
986
986
  }
987
987
  if (limit !== undefined) {
988
- request['limit'] = limit; // default 500, max 1000
988
+ request['limit'] = Math.min(limit, 1000); // default 500, max 1000
989
989
  }
990
990
  const response = await this.publicGetV2Klines(this.extend(request, params));
991
991
  //
@@ -2663,12 +2663,14 @@ class delta extends delta$1 {
2663
2663
  market = this.safeMarket(marketId, market);
2664
2664
  return {
2665
2665
  'info': data,
2666
+ 'symbol': market['symbol'],
2666
2667
  'type': undefined,
2667
2668
  'amount': undefined,
2668
2669
  'total': this.safeNumber(data, 'margin'),
2669
2670
  'code': undefined,
2670
- 'symbol': market['symbol'],
2671
2671
  'status': undefined,
2672
+ 'timestamp': undefined,
2673
+ 'datetime': undefined,
2672
2674
  };
2673
2675
  }
2674
2676
  async fetchOpenInterest(symbol, params = {}) {
@@ -1505,7 +1505,7 @@ class digifinex extends digifinex$1 {
1505
1505
  request['instrument_id'] = market['id'];
1506
1506
  request['granularity'] = timeframe;
1507
1507
  if (limit !== undefined) {
1508
- request['limit'] = limit;
1508
+ request['limit'] = Math.min(limit, 100);
1509
1509
  }
1510
1510
  response = await this.publicSwapGetPublicCandles(this.extend(request, params));
1511
1511
  }
@@ -4131,12 +4131,14 @@ class digifinex extends digifinex$1 {
4131
4131
  const rawType = this.safeInteger(data, 'type');
4132
4132
  return {
4133
4133
  'info': data,
4134
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
4134
4135
  'type': (rawType === 1) ? 'add' : 'reduce',
4135
4136
  'amount': this.safeNumber(data, 'amount'),
4136
4137
  'total': undefined,
4137
4138
  'code': market['settle'],
4138
- 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
4139
4139
  'status': undefined,
4140
+ 'timestamp': undefined,
4141
+ 'datetime': undefined,
4140
4142
  };
4141
4143
  }
4142
4144
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -262,12 +262,14 @@ class exmo extends exmo$1 {
262
262
  //
263
263
  return {
264
264
  'info': data,
265
+ 'symbol': this.safeSymbol(undefined, market),
265
266
  'type': undefined,
266
267
  'amount': undefined,
267
- 'code': this.safeValue(market, 'quote'),
268
- 'symbol': this.safeSymbol(undefined, market),
269
268
  'total': undefined,
269
+ 'code': this.safeValue(market, 'quote'),
270
270
  'status': 'ok',
271
+ 'timestamp': undefined,
272
+ 'datetime': undefined,
271
273
  };
272
274
  }
273
275
  async reduceMargin(symbol, amount, params = {}) {
@@ -860,16 +862,15 @@ class exmo extends exmo$1 {
860
862
  'symbol': market['id'],
861
863
  'resolution': this.safeString(this.timeframes, timeframe, timeframe),
862
864
  };
863
- const options = this.safeValue(this.options, 'fetchOHLCV');
864
- const maxLimit = this.safeInteger(options, 'maxLimit', 3000);
865
+ const maxLimit = 3000;
865
866
  const duration = this.parseTimeframe(timeframe);
866
867
  const now = this.milliseconds();
867
868
  if (since === undefined) {
868
869
  if (limit === undefined) {
869
870
  limit = 1000; // cap default at generous amount
870
871
  }
871
- if (limit > maxLimit) {
872
- limit = maxLimit; // avoid exception
872
+ else {
873
+ limit = Math.min(limit, maxLimit);
873
874
  }
874
875
  request['from'] = this.parseToInt(now / 1000) - limit * duration - 1;
875
876
  request['to'] = this.parseToInt(now / 1000);
@@ -877,15 +878,13 @@ class exmo extends exmo$1 {
877
878
  else {
878
879
  request['from'] = this.parseToInt(since / 1000) - 1;
879
880
  if (limit === undefined) {
880
- request['to'] = this.parseToInt(now / 1000);
881
+ limit = maxLimit;
881
882
  }
882
883
  else {
883
- if (limit > maxLimit) {
884
- throw new errors.BadRequest(this.id + ' fetchOHLCV() will serve ' + maxLimit.toString() + ' candles at most');
885
- }
886
- const to = this.sum(since, limit * duration * 1000);
887
- request['to'] = this.parseToInt(to / 1000);
884
+ limit = Math.min(limit, maxLimit);
888
885
  }
886
+ const to = this.sum(since, limit * duration * 1000);
887
+ request['to'] = this.parseToInt(to / 1000);
889
888
  }
890
889
  const response = await this.publicGetCandlesHistory(this.extend(request, params));
891
890
  //
@@ -1859,7 +1859,7 @@ class gate extends gate$1 {
1859
1859
  await this.loadMarkets();
1860
1860
  const currency = this.currency(code);
1861
1861
  const request = {
1862
- 'currency': currency['id'],
1862
+ 'currency': currency['id'], // todo: currencies have network-junctions
1863
1863
  };
1864
1864
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
1865
1865
  const addresses = this.safeValue(response, 'multichain_addresses');
@@ -1910,7 +1910,7 @@ class gate extends gate$1 {
1910
1910
  const rawNetwork = this.safeStringUpper(params, 'network');
1911
1911
  params = this.omit(params, 'network');
1912
1912
  const request = {
1913
- 'currency': currency['id'],
1913
+ 'currency': currency['id'], // todo: currencies have network-junctions
1914
1914
  };
1915
1915
  const response = await this.privateWalletGetDepositAddress(this.extend(request, params));
1916
1916
  //
@@ -3526,7 +3526,7 @@ class gate extends gate$1 {
3526
3526
  let currency = undefined;
3527
3527
  if (code !== undefined) {
3528
3528
  currency = this.currency(code);
3529
- request['currency'] = currency['id'];
3529
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
3530
3530
  }
3531
3531
  if (limit !== undefined) {
3532
3532
  request['limit'] = limit;
@@ -3564,7 +3564,7 @@ class gate extends gate$1 {
3564
3564
  let currency = undefined;
3565
3565
  if (code !== undefined) {
3566
3566
  currency = this.currency(code);
3567
- request['currency'] = currency['id'];
3567
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
3568
3568
  }
3569
3569
  if (limit !== undefined) {
3570
3570
  request['limit'] = limit;
@@ -3611,7 +3611,7 @@ class gate extends gate$1 {
3611
3611
  params = this.omit(params, 'network');
3612
3612
  }
3613
3613
  else {
3614
- request['chain'] = currency['id'];
3614
+ request['chain'] = currency['id']; // todo: currencies have network-junctions
3615
3615
  }
3616
3616
  const response = await this.privateWithdrawalsPostWithdrawals(this.extend(request, params));
3617
3617
  //
@@ -5145,7 +5145,7 @@ class gate extends gate$1 {
5145
5145
  params = this.omit(params, 'symbol');
5146
5146
  }
5147
5147
  if ((toId === 'futures') || (toId === 'delivery') || (fromId === 'futures') || (fromId === 'delivery')) {
5148
- request['settle'] = currency['id'];
5148
+ request['settle'] = currency['id']; // todo: currencies have network-junctions
5149
5149
  }
5150
5150
  const response = await this.privateWalletPostTransfers(this.extend(request, params));
5151
5151
  //
@@ -6115,11 +6115,14 @@ class gate extends gate$1 {
6115
6115
  const total = this.safeNumber(data, 'margin');
6116
6116
  return {
6117
6117
  'info': data,
6118
- 'amount': undefined,
6119
- 'code': this.safeValue(market, 'quote'),
6120
6118
  'symbol': market['symbol'],
6119
+ 'type': undefined,
6120
+ 'amount': undefined,
6121
6121
  'total': total,
6122
+ 'code': this.safeValue(market, 'quote'),
6122
6123
  'status': 'ok',
6124
+ 'timestamp': undefined,
6125
+ 'datetime': undefined,
6123
6126
  };
6124
6127
  }
6125
6128
  async reduceMargin(symbol, amount, params = {}) {
@@ -6450,7 +6453,7 @@ class gate extends gate$1 {
6450
6453
  if ((type === 'spot') || (type === 'margin')) {
6451
6454
  if (code !== undefined) {
6452
6455
  currency = this.currency(code);
6453
- request['currency'] = currency['id'];
6456
+ request['currency'] = currency['id']; // todo: currencies have network-junctions
6454
6457
  }
6455
6458
  }
6456
6459
  if ((type === 'swap') || (type === 'future')) {
@@ -7269,7 +7272,7 @@ class gate extends gate$1 {
7269
7272
  await this.loadMarkets();
7270
7273
  const currency = this.currency(code);
7271
7274
  const request = {
7272
- 'underlying': currency['code'] + '_USDT',
7275
+ 'underlying': currency['code'] + '_USDT', // todo: currency['id'].toUpperCase () & network junctions
7273
7276
  };
7274
7277
  const response = await this.publicOptionsGetContracts(this.extend(request, params));
7275
7278
  //
@@ -1734,7 +1734,7 @@ class hitbtc extends hitbtc$1 {
1734
1734
  }
1735
1735
  [request, params] = this.handleUntilOption('till', request, params);
1736
1736
  if (limit !== undefined) {
1737
- request['limit'] = limit;
1737
+ request['limit'] = Math.min(limit, 1000);
1738
1738
  }
1739
1739
  const price = this.safeString(params, 'price');
1740
1740
  params = this.omit(params, 'price');
@@ -3292,15 +3292,39 @@ class hitbtc extends hitbtc$1 {
3292
3292
  });
3293
3293
  }
3294
3294
  parseMarginModification(data, market = undefined) {
3295
+ //
3296
+ // addMargin/reduceMargin
3297
+ //
3298
+ // {
3299
+ // "symbol": "BTCUSDT_PERP",
3300
+ // "type": "isolated",
3301
+ // "leverage": "8.00",
3302
+ // "created_at": "2022-03-30T23:34:27.161Z",
3303
+ // "updated_at": "2022-03-30T23:34:27.161Z",
3304
+ // "currencies": [
3305
+ // {
3306
+ // "code": "USDT",
3307
+ // "margin_balance": "7.000000000000",
3308
+ // "reserved_orders": "0",
3309
+ // "reserved_positions": "0"
3310
+ // }
3311
+ // ],
3312
+ // "positions": null
3313
+ // }
3314
+ //
3295
3315
  const currencies = this.safeValue(data, 'currencies', []);
3296
3316
  const currencyInfo = this.safeValue(currencies, 0);
3317
+ const datetime = this.safeString(data, 'updated_at');
3297
3318
  return {
3298
3319
  'info': data,
3320
+ 'symbol': market['symbol'],
3299
3321
  'type': undefined,
3300
3322
  'amount': undefined,
3323
+ 'total': undefined,
3301
3324
  'code': this.safeString(currencyInfo, 'code'),
3302
- 'symbol': market['symbol'],
3303
3325
  'status': undefined,
3326
+ 'timestamp': this.parse8601(datetime),
3327
+ 'datetime': datetime,
3304
3328
  };
3305
3329
  }
3306
3330
  async reduceMargin(symbol, amount, params = {}) {
@@ -2962,7 +2962,7 @@ class htx extends htx$1 {
2962
2962
  const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
2963
2963
  if (market['contract']) {
2964
2964
  if (limit !== undefined) {
2965
- request['size'] = limit; // when using limit: from & to are ignored
2965
+ request['size'] = Math.min(limit, 2000); // when using limit: from & to are ignored
2966
2966
  // https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
2967
2967
  }
2968
2968
  else {
@@ -3054,7 +3054,7 @@ class htx extends htx$1 {
3054
3054
  [useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
3055
3055
  if (!useHistorical) {
3056
3056
  if (limit !== undefined) {
3057
- request['size'] = Math.min(2000, limit); // max 2000
3057
+ request['size'] = Math.min(limit, 2000); // max 2000
3058
3058
  }
3059
3059
  response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
3060
3060
  }
@@ -952,7 +952,7 @@ class huobijp extends huobijp$1 {
952
952
  'period': this.safeString(this.timeframes, timeframe, timeframe),
953
953
  };
954
954
  if (limit !== undefined) {
955
- request['size'] = limit;
955
+ request['size'] = Math.min(limit, 2000);
956
956
  }
957
957
  const response = await this.marketGetHistoryKline(this.extend(request, params));
958
958
  //