ccxt 4.2.63 → 4.2.65

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 (60) hide show
  1. package/README.md +3 -3
  2. package/build.sh +2 -2
  3. package/dist/ccxt.browser.js +565 -178
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +12 -0
  7. package/dist/cjs/src/binance.js +33 -12
  8. package/dist/cjs/src/bingx.js +58 -49
  9. package/dist/cjs/src/bitget.js +69 -1
  10. package/dist/cjs/src/bitmex.js +3 -1
  11. package/dist/cjs/src/blofin.js +46 -11
  12. package/dist/cjs/src/btcmarkets.js +12 -0
  13. package/dist/cjs/src/bybit.js +100 -7
  14. package/dist/cjs/src/coinbase.js +12 -2
  15. package/dist/cjs/src/delta.js +95 -1
  16. package/dist/cjs/src/gemini.js +9 -4
  17. package/dist/cjs/src/hitbtc.js +1 -1
  18. package/dist/cjs/src/krakenfutures.js +1 -0
  19. package/dist/cjs/src/kucoin.js +87 -62
  20. package/dist/cjs/src/pro/bitget.js +5 -5
  21. package/dist/cjs/src/pro/coinex.js +4 -4
  22. package/dist/cjs/src/pro/currencycom.js +1 -1
  23. package/dist/cjs/src/pro/lbank.js +1 -1
  24. package/dist/cjs/src/yobit.js +15 -15
  25. package/js/ccxt.d.ts +1 -1
  26. package/js/ccxt.js +1 -1
  27. package/js/src/abstract/blofin.d.ts +1 -0
  28. package/js/src/abstract/krakenfutures.d.ts +1 -0
  29. package/js/src/abstract/kucoin.d.ts +10 -0
  30. package/js/src/abstract/kucoinfutures.d.ts +10 -0
  31. package/js/src/base/Exchange.js +12 -0
  32. package/js/src/binance.d.ts +1 -1
  33. package/js/src/binance.js +33 -12
  34. package/js/src/bingx.js +58 -49
  35. package/js/src/bitget.d.ts +3 -1
  36. package/js/src/bitget.js +69 -1
  37. package/js/src/bitmex.js +3 -1
  38. package/js/src/blofin.d.ts +3 -1
  39. package/js/src/blofin.js +46 -11
  40. package/js/src/btcmarkets.js +12 -0
  41. package/js/src/bybit.d.ts +1 -0
  42. package/js/src/bybit.js +100 -7
  43. package/js/src/coinbase.js +12 -2
  44. package/js/src/delta.d.ts +3 -1
  45. package/js/src/delta.js +95 -1
  46. package/js/src/gate.d.ts +1 -1
  47. package/js/src/gemini.js +9 -4
  48. package/js/src/hitbtc.js +1 -1
  49. package/js/src/krakenfutures.js +1 -0
  50. package/js/src/kucoin.js +87 -62
  51. package/js/src/okx.d.ts +1 -1
  52. package/js/src/pro/bitget.js +5 -5
  53. package/js/src/pro/coinex.js +4 -4
  54. package/js/src/pro/currencycom.d.ts +1 -1
  55. package/js/src/pro/currencycom.js +1 -1
  56. package/js/src/pro/lbank.js +1 -1
  57. package/js/src/woo.d.ts +1 -1
  58. package/js/src/yobit.js +15 -15
  59. package/package.json +2 -2
  60. package/skip-tests.json +47 -22
package/js/src/kucoin.js CHANGED
@@ -120,6 +120,7 @@ export default class kucoin extends Exchange {
120
120
  'futuresPrivate': 'https://api-futures.kucoin.com',
121
121
  'futuresPublic': 'https://api-futures.kucoin.com',
122
122
  'webExchange': 'https://kucoin.com/_api',
123
+ 'broker': 'https://api-broker.kucoin.com',
123
124
  },
124
125
  'www': 'https://www.kucoin.com',
125
126
  'doc': [
@@ -232,7 +233,9 @@ export default class kucoin extends Exchange {
232
233
  'project/list': 10,
233
234
  'project/marketInterestRate': 7.5,
234
235
  'redeem/orders': 10,
235
- 'purchase/orders': 10, // 10SW
236
+ 'purchase/orders': 10,
237
+ // broker
238
+ 'broker/api/rebase/download': 3,
236
239
  },
237
240
  'post': {
238
241
  // account
@@ -378,6 +381,23 @@ export default class kucoin extends Exchange {
378
381
  'currency/currency/chain-info': 1, // this is temporary from webApi
379
382
  },
380
383
  },
384
+ 'broker': {
385
+ 'get': {
386
+ 'broker/nd/info': 2,
387
+ 'broker/nd/account': 2,
388
+ 'broker/nd/account/apikey': 2,
389
+ 'broker/nd/rebase/download': 3,
390
+ },
391
+ 'post': {
392
+ 'broker/nd/transfer': 1,
393
+ 'broker/nd/account': 3,
394
+ 'broker/nd/account/apikey': 3,
395
+ 'broker/nd/account/update-apikey': 3,
396
+ },
397
+ 'delete': {
398
+ 'broker/nd/account/apikey': 3,
399
+ },
400
+ },
381
401
  },
382
402
  'timeframes': {
383
403
  '1m': '1min',
@@ -895,7 +915,7 @@ export default class kucoin extends Exchange {
895
915
  // }
896
916
  // }
897
917
  //
898
- const data = this.safeValue(response, 'data', {});
918
+ const data = this.safeDict(response, 'data', {});
899
919
  const status = this.safeString(data, 'status');
900
920
  return {
901
921
  'status': (status === 'open') ? 'ok' : 'maintenance',
@@ -941,8 +961,8 @@ export default class kucoin extends Exchange {
941
961
  // ]
942
962
  // }
943
963
  //
944
- const data = this.safeValue(response, 'data');
945
- const options = this.safeValue(this.options, 'fetchMarkets', {});
964
+ const data = this.safeList(response, 'data');
965
+ const options = this.safeDict(this.options, 'fetchMarkets', {});
946
966
  const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
947
967
  let tickersResponse = {};
948
968
  if (fetchTickersFees) {
@@ -976,8 +996,8 @@ export default class kucoin extends Exchange {
976
996
  // }
977
997
  // }
978
998
  //
979
- const tickersData = this.safeValue(tickersResponse, 'data', {});
980
- const tickers = this.safeValue(tickersData, 'ticker', []);
999
+ const tickersData = this.safeDict(tickersResponse, 'data', {});
1000
+ const tickers = this.safeList(tickersData, 'ticker', []);
981
1001
  const tickersByMarketId = this.indexBy(tickers, 'symbol');
982
1002
  const result = [];
983
1003
  for (let i = 0; i < data.length; i++) {
@@ -987,7 +1007,7 @@ export default class kucoin extends Exchange {
987
1007
  const base = this.safeCurrencyCode(baseId);
988
1008
  const quote = this.safeCurrencyCode(quoteId);
989
1009
  // const quoteIncrement = this.safeNumber (market, 'quoteIncrement');
990
- const ticker = this.safeValue(tickersByMarketId, id, {});
1010
+ const ticker = this.safeDict(tickersByMarketId, id, {});
991
1011
  const makerFeeRate = this.safeString(ticker, 'makerFeeRate');
992
1012
  const takerFeeRate = this.safeString(ticker, 'takerFeeRate');
993
1013
  const makerCoefficient = this.safeString(ticker, 'makerCoefficient');
@@ -1003,11 +1023,11 @@ export default class kucoin extends Exchange {
1003
1023
  'settleId': undefined,
1004
1024
  'type': 'spot',
1005
1025
  'spot': true,
1006
- 'margin': this.safeValue(market, 'isMarginEnabled'),
1026
+ 'margin': this.safeBool(market, 'isMarginEnabled'),
1007
1027
  'swap': false,
1008
1028
  'future': false,
1009
1029
  'option': false,
1010
- 'active': this.safeValue(market, 'enableTrading'),
1030
+ 'active': this.safeBool(market, 'enableTrading'),
1011
1031
  'contract': false,
1012
1032
  'linear': undefined,
1013
1033
  'inverse': undefined,
@@ -1137,7 +1157,7 @@ export default class kucoin extends Exchange {
1137
1157
  let isWithdrawEnabled = undefined;
1138
1158
  let isDepositEnabled = undefined;
1139
1159
  const networks = {};
1140
- const chains = this.safeValue(entry, 'chains', []);
1160
+ const chains = this.safeList(entry, 'chains', []);
1141
1161
  const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
1142
1162
  const rawPrecision = this.safeString(entry, 'precision');
1143
1163
  const precision = this.parseNumber(this.parsePrecision(rawPrecision));
@@ -1165,7 +1185,7 @@ export default class kucoin extends Exchange {
1165
1185
  else {
1166
1186
  isDepositEnabled = isDepositEnabled || chainDepositEnabled;
1167
1187
  }
1168
- const chainExtraData = this.safeValue(extraChainsData, chainId, {});
1188
+ const chainExtraData = this.safeDict(extraChainsData, chainId, {});
1169
1189
  networks[networkCode] = {
1170
1190
  'info': chain,
1171
1191
  'id': chainId,
@@ -1240,7 +1260,7 @@ export default class kucoin extends Exchange {
1240
1260
  // ]
1241
1261
  // }
1242
1262
  //
1243
- const data = this.safeValue(response, 'data', []);
1263
+ const data = this.safeList(response, 'data', []);
1244
1264
  const result = [];
1245
1265
  for (let i = 0; i < data.length; i++) {
1246
1266
  const account = data[i];
@@ -1328,7 +1348,7 @@ export default class kucoin extends Exchange {
1328
1348
  // }
1329
1349
  // }
1330
1350
  //
1331
- const data = this.safeValue(response, 'data');
1351
+ const data = this.safeDict(response, 'data');
1332
1352
  return this.parseDepositWithdrawFee(data, currency);
1333
1353
  }
1334
1354
  parseDepositWithdrawFee(fee, currency = undefined) {
@@ -1359,7 +1379,7 @@ export default class kucoin extends Exchange {
1359
1379
  },
1360
1380
  'networks': {},
1361
1381
  };
1362
- const isWithdrawEnabled = this.safeValue(fee, 'isWithdrawEnabled');
1382
+ const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
1363
1383
  if (isWithdrawEnabled) {
1364
1384
  result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
1365
1385
  result['withdraw']['percentage'] = false;
@@ -1386,7 +1406,7 @@ export default class kucoin extends Exchange {
1386
1406
  //
1387
1407
  const defaultType = this.safeString2(this.options, methodName, 'defaultType', 'trade');
1388
1408
  const requestedType = this.safeString(params, 'type', defaultType);
1389
- const accountsByType = this.safeValue(this.options, 'accountsByType');
1409
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
1390
1410
  const type = this.safeString(accountsByType, requestedType);
1391
1411
  if (type === undefined) {
1392
1412
  const keys = Object.keys(accountsByType);
@@ -1527,8 +1547,8 @@ export default class kucoin extends Exchange {
1527
1547
  // }
1528
1548
  // }
1529
1549
  //
1530
- const data = this.safeValue(response, 'data', {});
1531
- const tickers = this.safeValue(data, 'ticker', []);
1550
+ const data = this.safeDict(response, 'data', {});
1551
+ const tickers = this.safeList(data, 'ticker', []);
1532
1552
  const time = this.safeInteger(data, 'time');
1533
1553
  const result = {};
1534
1554
  for (let i = 0; i < tickers.length; i++) {
@@ -1658,7 +1678,7 @@ export default class kucoin extends Exchange {
1658
1678
  // ]
1659
1679
  // }
1660
1680
  //
1661
- const data = this.safeValue(response, 'data', []);
1681
+ const data = this.safeList(response, 'data', []);
1662
1682
  return this.parseOHLCVs(data, market, timeframe, since, limit);
1663
1683
  }
1664
1684
  async createDepositAddress(code, params = {}) {
@@ -1686,7 +1706,7 @@ export default class kucoin extends Exchange {
1686
1706
  // {"code":"260000","msg":"Deposit address already exists."}
1687
1707
  // BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
1688
1708
  // BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
1689
- const data = this.safeValue(response, 'data', {});
1709
+ const data = this.safeDict(response, 'data', {});
1690
1710
  return this.parseDepositAddress(data, currency);
1691
1711
  }
1692
1712
  async fetchDepositAddress(code, params = {}) {
@@ -1781,7 +1801,7 @@ export default class kucoin extends Exchange {
1781
1801
  // }
1782
1802
  //
1783
1803
  this.options['versions']['private']['GET']['deposit-addresses'] = version;
1784
- const chains = this.safeValue(response, 'data', []);
1804
+ const chains = this.safeList(response, 'data', []);
1785
1805
  const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
1786
1806
  'currency': currency['id'],
1787
1807
  });
@@ -1854,7 +1874,7 @@ export default class kucoin extends Exchange {
1854
1874
  // ]
1855
1875
  // }
1856
1876
  //
1857
- const data = this.safeValue(response, 'data', {});
1877
+ const data = this.safeDict(response, 'data', {});
1858
1878
  const timestamp = this.safeInteger(data, 'time');
1859
1879
  const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1);
1860
1880
  orderbook['nonce'] = this.safeInteger(data, 'sequence');
@@ -1956,7 +1976,7 @@ export default class kucoin extends Exchange {
1956
1976
  // }
1957
1977
  // }
1958
1978
  //
1959
- const data = this.safeValue(response, 'data', {});
1979
+ const data = this.safeDict(response, 'data', {});
1960
1980
  return this.parseOrder(data, market);
1961
1981
  }
1962
1982
  async createMarketOrderWithCost(symbol, side, cost, params = {}) {
@@ -2084,8 +2104,8 @@ export default class kucoin extends Exchange {
2084
2104
  // },
2085
2105
  // }
2086
2106
  //
2087
- let data = this.safeValue(response, 'data', {});
2088
- data = this.safeValue(data, 'data', []);
2107
+ let data = this.safeDict(response, 'data', {});
2108
+ data = this.safeList(data, 'data', []);
2089
2109
  return this.parseOrders(data);
2090
2110
  }
2091
2111
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2202,7 +2222,7 @@ export default class kucoin extends Exchange {
2202
2222
  // }
2203
2223
  // }
2204
2224
  //
2205
- const data = this.safeValue(response, 'data', {});
2225
+ const data = this.safeDict(response, 'data', {});
2206
2226
  return this.parseOrder(data, market);
2207
2227
  }
2208
2228
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -2226,7 +2246,7 @@ export default class kucoin extends Exchange {
2226
2246
  await this.loadMarkets();
2227
2247
  const request = {};
2228
2248
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2229
- const stop = this.safeValue2(params, 'stop', 'trigger', false);
2249
+ const stop = this.safeBool2(params, 'stop', 'trigger', false);
2230
2250
  const hf = this.safeBool(params, 'hf', false);
2231
2251
  if (hf) {
2232
2252
  if (symbol === undefined) {
@@ -2426,7 +2446,7 @@ export default class kucoin extends Exchange {
2426
2446
  // ]
2427
2447
  // }
2428
2448
  // }
2429
- const responseData = this.safeValue(response, 'data', {});
2449
+ const responseData = this.safeDict(response, 'data', {});
2430
2450
  const orders = this.safeValue(responseData, 'items', responseData);
2431
2451
  return this.parseOrders(orders, market, since, limit);
2432
2452
  }
@@ -2562,7 +2582,7 @@ export default class kucoin extends Exchange {
2562
2582
  response = await this.privateGetOrdersOrderId(this.extend(request, params));
2563
2583
  }
2564
2584
  }
2565
- let responseData = this.safeValue(response, 'data', {});
2585
+ let responseData = this.safeDict(response, 'data', {});
2566
2586
  if (Array.isArray(responseData)) {
2567
2587
  responseData = this.safeValue(responseData, 0);
2568
2588
  }
@@ -2697,7 +2717,7 @@ export default class kucoin extends Exchange {
2697
2717
  const responseStop = this.safeString(order, 'stop');
2698
2718
  const stop = responseStop !== undefined;
2699
2719
  const stopTriggered = this.safeBool(order, 'stopTriggered', false);
2700
- const isActive = this.safeValue2(order, 'isActive', 'active');
2720
+ const isActive = this.safeBool2(order, 'isActive', 'active');
2701
2721
  const responseStatus = this.safeString(order, 'status');
2702
2722
  let status = undefined;
2703
2723
  if (isActive !== undefined) {
@@ -2730,7 +2750,7 @@ export default class kucoin extends Exchange {
2730
2750
  'symbol': this.safeSymbol(marketId, market, '-'),
2731
2751
  'type': this.safeString(order, 'type'),
2732
2752
  'timeInForce': this.safeString(order, 'timeInForce'),
2733
- 'postOnly': this.safeValue(order, 'postOnly'),
2753
+ 'postOnly': this.safeBool(order, 'postOnly'),
2734
2754
  'side': this.safeString(order, 'side'),
2735
2755
  'amount': this.safeString(order, 'size'),
2736
2756
  'price': this.safeString(order, 'price'),
@@ -2870,13 +2890,13 @@ export default class kucoin extends Exchange {
2870
2890
  // ]
2871
2891
  // }
2872
2892
  //
2873
- const data = this.safeValue(response, 'data', {});
2893
+ const data = this.safeDict(response, 'data', {});
2874
2894
  let trades = undefined;
2875
2895
  if (parseResponseData) {
2876
2896
  trades = data;
2877
2897
  }
2878
2898
  else {
2879
- trades = this.safeValue(data, 'items', []);
2899
+ trades = this.safeList(data, 'items', []);
2880
2900
  }
2881
2901
  return this.parseTrades(trades, market, since, limit);
2882
2902
  }
@@ -2919,7 +2939,7 @@ export default class kucoin extends Exchange {
2919
2939
  // ]
2920
2940
  // }
2921
2941
  //
2922
- const trades = this.safeValue(response, 'data', []);
2942
+ const trades = this.safeList(response, 'data', []);
2923
2943
  return this.parseTrades(trades, market, since, limit);
2924
2944
  }
2925
2945
  parseTrade(trade, market = undefined) {
@@ -3081,8 +3101,8 @@ export default class kucoin extends Exchange {
3081
3101
  // ]
3082
3102
  // }
3083
3103
  //
3084
- const data = this.safeValue(response, 'data', []);
3085
- const first = this.safeValue(data, 0);
3104
+ const data = this.safeList(response, 'data', []);
3105
+ const first = this.safeDict(data, 0);
3086
3106
  const marketId = this.safeString(first, 'symbol');
3087
3107
  return {
3088
3108
  'info': response,
@@ -3143,7 +3163,7 @@ export default class kucoin extends Exchange {
3143
3163
  // }
3144
3164
  // }
3145
3165
  //
3146
- const data = this.safeValue(response, 'data', {});
3166
+ const data = this.safeDict(response, 'data', {});
3147
3167
  return this.parseTransaction(data, currency);
3148
3168
  }
3149
3169
  parseTransactionStatus(status) {
@@ -3243,7 +3263,7 @@ export default class kucoin extends Exchange {
3243
3263
  updated = updated * 1000;
3244
3264
  }
3245
3265
  }
3246
- const internal = this.safeValue(transaction, 'isInner');
3266
+ const internal = this.safeBool(transaction, 'isInner');
3247
3267
  const tag = this.safeString(transaction, 'memo');
3248
3268
  return {
3249
3269
  'info': transaction,
@@ -3469,7 +3489,7 @@ export default class kucoin extends Exchange {
3469
3489
  }
3470
3490
  const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
3471
3491
  const requestedType = this.safeString(params, 'type', defaultType);
3472
- const accountsByType = this.safeValue(this.options, 'accountsByType');
3492
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
3473
3493
  let type = this.safeString(accountsByType, requestedType, requestedType);
3474
3494
  params = this.omit(params, 'type');
3475
3495
  const isHf = this.safeBool(params, 'hf', false);
@@ -3551,7 +3571,7 @@ export default class kucoin extends Exchange {
3551
3571
  // }
3552
3572
  // }
3553
3573
  //
3554
- const data = this.safeValue(response, 'data', []);
3574
+ const data = this.safeList(response, 'data', []);
3555
3575
  const result = {
3556
3576
  'info': response,
3557
3577
  'timestamp': undefined,
@@ -3563,8 +3583,8 @@ export default class kucoin extends Exchange {
3563
3583
  const entry = assets[i];
3564
3584
  const marketId = this.safeString(entry, 'symbol');
3565
3585
  const symbol = this.safeSymbol(marketId, undefined, '_');
3566
- const base = this.safeValue(entry, 'baseAsset', {});
3567
- const quote = this.safeValue(entry, 'quoteAsset', {});
3586
+ const base = this.safeDict(entry, 'baseAsset', {});
3587
+ const quote = this.safeDict(entry, 'quoteAsset', {});
3568
3588
  const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
3569
3589
  const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
3570
3590
  const subResult = {};
@@ -3574,7 +3594,7 @@ export default class kucoin extends Exchange {
3574
3594
  }
3575
3595
  }
3576
3596
  else if (cross) {
3577
- const accounts = this.safeValue(data, 'accounts', []);
3597
+ const accounts = this.safeList(data, 'accounts', []);
3578
3598
  for (let i = 0; i < accounts.length; i++) {
3579
3599
  const balance = accounts[i];
3580
3600
  const currencyId = this.safeString(balance, 'currency');
@@ -3659,7 +3679,7 @@ export default class kucoin extends Exchange {
3659
3679
  // }
3660
3680
  // }
3661
3681
  //
3662
- const data = this.safeValue(response, 'data');
3682
+ const data = this.safeDict(response, 'data');
3663
3683
  return this.parseTransfer(data, currency);
3664
3684
  }
3665
3685
  else {
@@ -3691,7 +3711,7 @@ export default class kucoin extends Exchange {
3691
3711
  // }
3692
3712
  // }
3693
3713
  //
3694
- const data = this.safeValue(response, 'data');
3714
+ const data = this.safeDict(response, 'data');
3695
3715
  return this.parseTransfer(data, currency);
3696
3716
  }
3697
3717
  }
@@ -3735,7 +3755,7 @@ export default class kucoin extends Exchange {
3735
3755
  const rawStatus = this.safeString(transfer, 'status');
3736
3756
  const accountFromRaw = this.safeStringLower(transfer, 'payAccountType');
3737
3757
  const accountToRaw = this.safeStringLower(transfer, 'recAccountType');
3738
- const accountsByType = this.safeValue(this.options, 'accountsByType');
3758
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
3739
3759
  const accountFrom = this.safeString(accountsByType, accountFromRaw, accountFromRaw);
3740
3760
  const accountTo = this.safeString(accountsByType, accountToRaw, accountToRaw);
3741
3761
  return {
@@ -3905,7 +3925,7 @@ export default class kucoin extends Exchange {
3905
3925
  await this.loadAccounts();
3906
3926
  let paginate = false;
3907
3927
  [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
3908
- const isHf = this.safeValue(params, 'hf');
3928
+ const isHf = this.safeBool(params, 'hf');
3909
3929
  params = this.omit(params, 'hf');
3910
3930
  if (paginate) {
3911
3931
  return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
@@ -3987,9 +4007,9 @@ export default class kucoin extends Exchange {
3987
4007
  return this.parseLedger(items, currency, since, limit);
3988
4008
  }
3989
4009
  calculateRateLimiterCost(api, method, path, params, config = {}) {
3990
- const versions = this.safeValue(this.options, 'versions', {});
3991
- const apiVersions = this.safeValue(versions, api, {});
3992
- const methodVersions = this.safeValue(apiVersions, method, {});
4010
+ const versions = this.safeDict(this.options, 'versions', {});
4011
+ const apiVersions = this.safeDict(versions, api, {});
4012
+ const methodVersions = this.safeDict(apiVersions, method, {});
3993
4013
  const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
3994
4014
  const version = this.safeString(params, 'version', defaultVersion);
3995
4015
  if (version === 'v3' && ('v3' in config)) {
@@ -4133,8 +4153,8 @@ export default class kucoin extends Exchange {
4133
4153
  // }
4134
4154
  // }
4135
4155
  //
4136
- const data = this.safeValue(response, 'data', {});
4137
- const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, 'accounts', []);
4156
+ const data = this.safeDict(response, 'data', {});
4157
+ const assets = (marginMode === 'isolated') ? this.safeList(data, 'assets', []) : this.safeList(data, 'accounts', []);
4138
4158
  return this.parseBorrowInterests(assets, undefined);
4139
4159
  }
4140
4160
  parseBorrowInterest(info, market = undefined) {
@@ -4187,7 +4207,7 @@ export default class kucoin extends Exchange {
4187
4207
  market = this.safeMarket(marketId, market);
4188
4208
  const symbol = this.safeString(market, 'symbol');
4189
4209
  const timestamp = this.safeInteger(info, 'createdAt');
4190
- const isolatedBase = this.safeValue(info, 'baseAsset', {});
4210
+ const isolatedBase = this.safeDict(info, 'baseAsset', {});
4191
4211
  let amountBorrowed = undefined;
4192
4212
  let interest = undefined;
4193
4213
  let currencyId = undefined;
@@ -4245,7 +4265,7 @@ export default class kucoin extends Exchange {
4245
4265
  // }
4246
4266
  // }
4247
4267
  //
4248
- const data = this.safeValue(response, 'data', {});
4268
+ const data = this.safeDict(response, 'data', {});
4249
4269
  return this.parseMarginLoan(data, currency);
4250
4270
  }
4251
4271
  async borrowIsolatedMargin(symbol, code, amount, params = {}) {
@@ -4284,7 +4304,7 @@ export default class kucoin extends Exchange {
4284
4304
  // }
4285
4305
  // }
4286
4306
  //
4287
- const data = this.safeValue(response, 'data', {});
4307
+ const data = this.safeDict(response, 'data', {});
4288
4308
  return this.parseMarginLoan(data, currency);
4289
4309
  }
4290
4310
  async repayCrossMargin(code, amount, params = {}) {
@@ -4317,7 +4337,7 @@ export default class kucoin extends Exchange {
4317
4337
  // }
4318
4338
  // }
4319
4339
  //
4320
- const data = this.safeValue(response, 'data', {});
4340
+ const data = this.safeDict(response, 'data', {});
4321
4341
  return this.parseMarginLoan(data, currency);
4322
4342
  }
4323
4343
  async repayIsolatedMargin(symbol, code, amount, params = {}) {
@@ -4354,7 +4374,7 @@ export default class kucoin extends Exchange {
4354
4374
  // }
4355
4375
  // }
4356
4376
  //
4357
- const data = this.safeValue(response, 'data', {});
4377
+ const data = this.safeDict(response, 'data', {});
4358
4378
  return this.parseMarginLoan(data, currency);
4359
4379
  }
4360
4380
  parseMarginLoan(info, currency = undefined) {
@@ -4406,7 +4426,7 @@ export default class kucoin extends Exchange {
4406
4426
  // },
4407
4427
  // ]
4408
4428
  //
4409
- const data = this.safeValue(response, 'data', []);
4429
+ const data = this.safeList(response, 'data', []);
4410
4430
  return this.parseDepositWithdrawFees(data, codes, 'currency');
4411
4431
  }
4412
4432
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
@@ -4415,9 +4435,9 @@ export default class kucoin extends Exchange {
4415
4435
  // ↑ ↑
4416
4436
  // ↑ ↑
4417
4437
  //
4418
- const versions = this.safeValue(this.options, 'versions', {});
4419
- const apiVersions = this.safeValue(versions, api, {});
4420
- const methodVersions = this.safeValue(apiVersions, method, {});
4438
+ const versions = this.safeDict(this.options, 'versions', {});
4439
+ const apiVersions = this.safeDict(versions, api, {});
4440
+ const methodVersions = this.safeDict(apiVersions, method, {});
4421
4441
  const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
4422
4442
  const version = this.safeString(params, 'version', defaultVersion);
4423
4443
  params = this.omit(params, 'version');
@@ -4442,7 +4462,8 @@ export default class kucoin extends Exchange {
4442
4462
  url = url + endpoint;
4443
4463
  const isFuturePrivate = (api === 'futuresPrivate');
4444
4464
  const isPrivate = (api === 'private');
4445
- if (isPrivate || isFuturePrivate) {
4465
+ const isBroker = (api === 'private');
4466
+ if (isPrivate || isFuturePrivate || isBroker) {
4446
4467
  this.checkRequiredCredentials();
4447
4468
  const timestamp = this.nonce().toString();
4448
4469
  headers = this.extend({
@@ -4461,7 +4482,7 @@ export default class kucoin extends Exchange {
4461
4482
  const payload = timestamp + method + endpoint + endpart;
4462
4483
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256, 'base64');
4463
4484
  headers['KC-API-SIGN'] = signature;
4464
- let partner = this.safeValue(this.options, 'partner', {});
4485
+ let partner = this.safeDict(this.options, 'partner', {});
4465
4486
  partner = isFuturePrivate ? this.safeValue(partner, 'future', partner) : this.safeValue(partner, 'spot', partner);
4466
4487
  const partnerId = this.safeString(partner, 'id');
4467
4488
  const partnerSecret = this.safeString2(partner, 'secret', 'key');
@@ -4471,6 +4492,10 @@ export default class kucoin extends Exchange {
4471
4492
  headers['KC-API-PARTNER-SIGN'] = partnerSignature;
4472
4493
  headers['KC-API-PARTNER'] = partnerId;
4473
4494
  }
4495
+ if (isBroker) {
4496
+ const brokerName = this.safeString(partner, 'name');
4497
+ headers['KC-BROKER-NAME'] = brokerName;
4498
+ }
4474
4499
  }
4475
4500
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
4476
4501
  }
package/js/src/okx.d.ts CHANGED
@@ -280,7 +280,7 @@ export default class okx extends Exchange {
280
280
  fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
281
281
  fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OpenInterest[]>;
282
282
  parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
283
- setSandboxMode(enable: any): void;
283
+ setSandboxMode(enable: boolean): void;
284
284
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<{}>;
285
285
  parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): {};
286
286
  fetchSettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
@@ -1294,7 +1294,7 @@ export default class bitget extends bitgetRest {
1294
1294
  if (feeAmount !== undefined) {
1295
1295
  const feeCurrency = this.safeString(fee, 'feeCoin');
1296
1296
  feeObject = {
1297
- 'cost': Precise.stringAbs(feeAmount),
1297
+ 'cost': this.parseNumber(Precise.stringAbs(feeAmount)),
1298
1298
  'currency': this.safeCurrencyCode(feeCurrency),
1299
1299
  };
1300
1300
  }
@@ -1307,10 +1307,10 @@ export default class bitget extends bitgetRest {
1307
1307
  if (side === 'buy' && market['spot'] && (type === 'market')) {
1308
1308
  cost = this.safeString(order, 'newSize', cost);
1309
1309
  }
1310
- let filled = this.safeString2(order, 'accBaseVolume', 'baseVolume');
1311
- if (market['spot'] && (rawStatus !== 'live')) {
1312
- filled = Precise.stringDiv(cost, avgPrice);
1313
- }
1310
+ const filled = this.safeString2(order, 'accBaseVolume', 'baseVolume');
1311
+ // if (market['spot'] && (rawStatus !== 'live')) {
1312
+ // filled = Precise.stringDiv (cost, avgPrice);
1313
+ // }
1314
1314
  let amount = this.safeString(order, 'baseVolume');
1315
1315
  if (!market['spot'] || !(side === 'buy' && type === 'market')) {
1316
1316
  amount = this.safeString(order, 'newSize', amount);
@@ -1049,7 +1049,7 @@ export default class coinex extends coinexRest {
1049
1049
  const messageHash = 'authenticated:spot';
1050
1050
  let future = this.safeValue(client.subscriptions, messageHash);
1051
1051
  if (future !== undefined) {
1052
- return future;
1052
+ return await future;
1053
1053
  }
1054
1054
  const requestId = this.requestId();
1055
1055
  const subscribe = {
@@ -1069,13 +1069,13 @@ export default class coinex extends coinexRest {
1069
1069
  };
1070
1070
  future = this.watch(url, messageHash, request, requestId, subscribe);
1071
1071
  client.subscriptions[messageHash] = future;
1072
- return future;
1072
+ return await future;
1073
1073
  }
1074
1074
  else {
1075
1075
  const messageHash = 'authenticated:swap';
1076
1076
  let future = this.safeValue(client.subscriptions, messageHash);
1077
1077
  if (future !== undefined) {
1078
- return future;
1078
+ return await future;
1079
1079
  }
1080
1080
  const requestId = this.requestId();
1081
1081
  const subscribe = {
@@ -1095,7 +1095,7 @@ export default class coinex extends coinexRest {
1095
1095
  };
1096
1096
  future = this.watch(url, messageHash, request, requestId, subscribe);
1097
1097
  client.subscriptions[messageHash] = future;
1098
- return future;
1098
+ return await future;
1099
1099
  }
1100
1100
  }
1101
1101
  }
@@ -26,7 +26,7 @@ export default class currencycom extends currencycomRest {
26
26
  cost: number;
27
27
  fee: any;
28
28
  };
29
- handleTrades(client: Client, message: any, subscription: any): void;
29
+ handleTrades(client: Client, message: any): void;
30
30
  findTimeframe(timeframe: any, defaultTimeframes?: any): string;
31
31
  handleOHLCV(client: Client, message: any): void;
32
32
  requestId(): any;
@@ -194,7 +194,7 @@ export default class currencycom extends currencycomRest {
194
194
  'fee': undefined,
195
195
  };
196
196
  }
197
- handleTrades(client, message, subscription) {
197
+ handleTrades(client, message) {
198
198
  //
199
199
  // {
200
200
  // "status": "OK",
@@ -175,7 +175,7 @@ export default class lbank extends lbankRest {
175
175
  // },
176
176
  // type: 'kbar',
177
177
  // pair: 'btc_usdt',
178
- // TS: '2022-10-02T12:44:15.864'
178
+ // TS: '2022-10-02T12:44:15.865'
179
179
  // }
180
180
  //
181
181
  const marketId = this.safeString(message, 'pair');
package/js/src/woo.d.ts CHANGED
@@ -173,5 +173,5 @@ export default class woo extends Exchange {
173
173
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
174
174
  parsePosition(position: any, market?: Market): import("./base/types.js").Position;
175
175
  defaultNetworkCodeForCurrency(code: any): any;
176
- setSandboxMode(enable: any): void;
176
+ setSandboxMode(enable: boolean): void;
177
177
  }