ccxt 4.2.64 → 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.
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': [
@@ -233,6 +234,7 @@ export default class kucoin extends Exchange {
233
234
  'project/marketInterestRate': 7.5,
234
235
  'redeem/orders': 10,
235
236
  'purchase/orders': 10,
237
+ // broker
236
238
  'broker/api/rebase/download': 3,
237
239
  },
238
240
  'post': {
@@ -379,6 +381,23 @@ export default class kucoin extends Exchange {
379
381
  'currency/currency/chain-info': 1, // this is temporary from webApi
380
382
  },
381
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
+ },
382
401
  },
383
402
  'timeframes': {
384
403
  '1m': '1min',
@@ -896,7 +915,7 @@ export default class kucoin extends Exchange {
896
915
  // }
897
916
  // }
898
917
  //
899
- const data = this.safeValue(response, 'data', {});
918
+ const data = this.safeDict(response, 'data', {});
900
919
  const status = this.safeString(data, 'status');
901
920
  return {
902
921
  'status': (status === 'open') ? 'ok' : 'maintenance',
@@ -942,8 +961,8 @@ export default class kucoin extends Exchange {
942
961
  // ]
943
962
  // }
944
963
  //
945
- const data = this.safeValue(response, 'data');
946
- const options = this.safeValue(this.options, 'fetchMarkets', {});
964
+ const data = this.safeList(response, 'data');
965
+ const options = this.safeDict(this.options, 'fetchMarkets', {});
947
966
  const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
948
967
  let tickersResponse = {};
949
968
  if (fetchTickersFees) {
@@ -977,8 +996,8 @@ export default class kucoin extends Exchange {
977
996
  // }
978
997
  // }
979
998
  //
980
- const tickersData = this.safeValue(tickersResponse, 'data', {});
981
- const tickers = this.safeValue(tickersData, 'ticker', []);
999
+ const tickersData = this.safeDict(tickersResponse, 'data', {});
1000
+ const tickers = this.safeList(tickersData, 'ticker', []);
982
1001
  const tickersByMarketId = this.indexBy(tickers, 'symbol');
983
1002
  const result = [];
984
1003
  for (let i = 0; i < data.length; i++) {
@@ -988,7 +1007,7 @@ export default class kucoin extends Exchange {
988
1007
  const base = this.safeCurrencyCode(baseId);
989
1008
  const quote = this.safeCurrencyCode(quoteId);
990
1009
  // const quoteIncrement = this.safeNumber (market, 'quoteIncrement');
991
- const ticker = this.safeValue(tickersByMarketId, id, {});
1010
+ const ticker = this.safeDict(tickersByMarketId, id, {});
992
1011
  const makerFeeRate = this.safeString(ticker, 'makerFeeRate');
993
1012
  const takerFeeRate = this.safeString(ticker, 'takerFeeRate');
994
1013
  const makerCoefficient = this.safeString(ticker, 'makerCoefficient');
@@ -1004,11 +1023,11 @@ export default class kucoin extends Exchange {
1004
1023
  'settleId': undefined,
1005
1024
  'type': 'spot',
1006
1025
  'spot': true,
1007
- 'margin': this.safeValue(market, 'isMarginEnabled'),
1026
+ 'margin': this.safeBool(market, 'isMarginEnabled'),
1008
1027
  'swap': false,
1009
1028
  'future': false,
1010
1029
  'option': false,
1011
- 'active': this.safeValue(market, 'enableTrading'),
1030
+ 'active': this.safeBool(market, 'enableTrading'),
1012
1031
  'contract': false,
1013
1032
  'linear': undefined,
1014
1033
  'inverse': undefined,
@@ -1138,7 +1157,7 @@ export default class kucoin extends Exchange {
1138
1157
  let isWithdrawEnabled = undefined;
1139
1158
  let isDepositEnabled = undefined;
1140
1159
  const networks = {};
1141
- const chains = this.safeValue(entry, 'chains', []);
1160
+ const chains = this.safeList(entry, 'chains', []);
1142
1161
  const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
1143
1162
  const rawPrecision = this.safeString(entry, 'precision');
1144
1163
  const precision = this.parseNumber(this.parsePrecision(rawPrecision));
@@ -1166,7 +1185,7 @@ export default class kucoin extends Exchange {
1166
1185
  else {
1167
1186
  isDepositEnabled = isDepositEnabled || chainDepositEnabled;
1168
1187
  }
1169
- const chainExtraData = this.safeValue(extraChainsData, chainId, {});
1188
+ const chainExtraData = this.safeDict(extraChainsData, chainId, {});
1170
1189
  networks[networkCode] = {
1171
1190
  'info': chain,
1172
1191
  'id': chainId,
@@ -1241,7 +1260,7 @@ export default class kucoin extends Exchange {
1241
1260
  // ]
1242
1261
  // }
1243
1262
  //
1244
- const data = this.safeValue(response, 'data', []);
1263
+ const data = this.safeList(response, 'data', []);
1245
1264
  const result = [];
1246
1265
  for (let i = 0; i < data.length; i++) {
1247
1266
  const account = data[i];
@@ -1329,7 +1348,7 @@ export default class kucoin extends Exchange {
1329
1348
  // }
1330
1349
  // }
1331
1350
  //
1332
- const data = this.safeValue(response, 'data');
1351
+ const data = this.safeDict(response, 'data');
1333
1352
  return this.parseDepositWithdrawFee(data, currency);
1334
1353
  }
1335
1354
  parseDepositWithdrawFee(fee, currency = undefined) {
@@ -1360,7 +1379,7 @@ export default class kucoin extends Exchange {
1360
1379
  },
1361
1380
  'networks': {},
1362
1381
  };
1363
- const isWithdrawEnabled = this.safeValue(fee, 'isWithdrawEnabled');
1382
+ const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
1364
1383
  if (isWithdrawEnabled) {
1365
1384
  result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
1366
1385
  result['withdraw']['percentage'] = false;
@@ -1387,7 +1406,7 @@ export default class kucoin extends Exchange {
1387
1406
  //
1388
1407
  const defaultType = this.safeString2(this.options, methodName, 'defaultType', 'trade');
1389
1408
  const requestedType = this.safeString(params, 'type', defaultType);
1390
- const accountsByType = this.safeValue(this.options, 'accountsByType');
1409
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
1391
1410
  const type = this.safeString(accountsByType, requestedType);
1392
1411
  if (type === undefined) {
1393
1412
  const keys = Object.keys(accountsByType);
@@ -1528,8 +1547,8 @@ export default class kucoin extends Exchange {
1528
1547
  // }
1529
1548
  // }
1530
1549
  //
1531
- const data = this.safeValue(response, 'data', {});
1532
- const tickers = this.safeValue(data, 'ticker', []);
1550
+ const data = this.safeDict(response, 'data', {});
1551
+ const tickers = this.safeList(data, 'ticker', []);
1533
1552
  const time = this.safeInteger(data, 'time');
1534
1553
  const result = {};
1535
1554
  for (let i = 0; i < tickers.length; i++) {
@@ -1659,7 +1678,7 @@ export default class kucoin extends Exchange {
1659
1678
  // ]
1660
1679
  // }
1661
1680
  //
1662
- const data = this.safeValue(response, 'data', []);
1681
+ const data = this.safeList(response, 'data', []);
1663
1682
  return this.parseOHLCVs(data, market, timeframe, since, limit);
1664
1683
  }
1665
1684
  async createDepositAddress(code, params = {}) {
@@ -1687,7 +1706,7 @@ export default class kucoin extends Exchange {
1687
1706
  // {"code":"260000","msg":"Deposit address already exists."}
1688
1707
  // BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
1689
1708
  // BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
1690
- const data = this.safeValue(response, 'data', {});
1709
+ const data = this.safeDict(response, 'data', {});
1691
1710
  return this.parseDepositAddress(data, currency);
1692
1711
  }
1693
1712
  async fetchDepositAddress(code, params = {}) {
@@ -1782,7 +1801,7 @@ export default class kucoin extends Exchange {
1782
1801
  // }
1783
1802
  //
1784
1803
  this.options['versions']['private']['GET']['deposit-addresses'] = version;
1785
- const chains = this.safeValue(response, 'data', []);
1804
+ const chains = this.safeList(response, 'data', []);
1786
1805
  const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
1787
1806
  'currency': currency['id'],
1788
1807
  });
@@ -1855,7 +1874,7 @@ export default class kucoin extends Exchange {
1855
1874
  // ]
1856
1875
  // }
1857
1876
  //
1858
- const data = this.safeValue(response, 'data', {});
1877
+ const data = this.safeDict(response, 'data', {});
1859
1878
  const timestamp = this.safeInteger(data, 'time');
1860
1879
  const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1);
1861
1880
  orderbook['nonce'] = this.safeInteger(data, 'sequence');
@@ -1957,7 +1976,7 @@ export default class kucoin extends Exchange {
1957
1976
  // }
1958
1977
  // }
1959
1978
  //
1960
- const data = this.safeValue(response, 'data', {});
1979
+ const data = this.safeDict(response, 'data', {});
1961
1980
  return this.parseOrder(data, market);
1962
1981
  }
1963
1982
  async createMarketOrderWithCost(symbol, side, cost, params = {}) {
@@ -2085,8 +2104,8 @@ export default class kucoin extends Exchange {
2085
2104
  // },
2086
2105
  // }
2087
2106
  //
2088
- let data = this.safeValue(response, 'data', {});
2089
- data = this.safeValue(data, 'data', []);
2107
+ let data = this.safeDict(response, 'data', {});
2108
+ data = this.safeList(data, 'data', []);
2090
2109
  return this.parseOrders(data);
2091
2110
  }
2092
2111
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2203,7 +2222,7 @@ export default class kucoin extends Exchange {
2203
2222
  // }
2204
2223
  // }
2205
2224
  //
2206
- const data = this.safeValue(response, 'data', {});
2225
+ const data = this.safeDict(response, 'data', {});
2207
2226
  return this.parseOrder(data, market);
2208
2227
  }
2209
2228
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -2227,7 +2246,7 @@ export default class kucoin extends Exchange {
2227
2246
  await this.loadMarkets();
2228
2247
  const request = {};
2229
2248
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2230
- const stop = this.safeValue2(params, 'stop', 'trigger', false);
2249
+ const stop = this.safeBool2(params, 'stop', 'trigger', false);
2231
2250
  const hf = this.safeBool(params, 'hf', false);
2232
2251
  if (hf) {
2233
2252
  if (symbol === undefined) {
@@ -2427,7 +2446,7 @@ export default class kucoin extends Exchange {
2427
2446
  // ]
2428
2447
  // }
2429
2448
  // }
2430
- const responseData = this.safeValue(response, 'data', {});
2449
+ const responseData = this.safeDict(response, 'data', {});
2431
2450
  const orders = this.safeValue(responseData, 'items', responseData);
2432
2451
  return this.parseOrders(orders, market, since, limit);
2433
2452
  }
@@ -2563,7 +2582,7 @@ export default class kucoin extends Exchange {
2563
2582
  response = await this.privateGetOrdersOrderId(this.extend(request, params));
2564
2583
  }
2565
2584
  }
2566
- let responseData = this.safeValue(response, 'data', {});
2585
+ let responseData = this.safeDict(response, 'data', {});
2567
2586
  if (Array.isArray(responseData)) {
2568
2587
  responseData = this.safeValue(responseData, 0);
2569
2588
  }
@@ -2698,7 +2717,7 @@ export default class kucoin extends Exchange {
2698
2717
  const responseStop = this.safeString(order, 'stop');
2699
2718
  const stop = responseStop !== undefined;
2700
2719
  const stopTriggered = this.safeBool(order, 'stopTriggered', false);
2701
- const isActive = this.safeValue2(order, 'isActive', 'active');
2720
+ const isActive = this.safeBool2(order, 'isActive', 'active');
2702
2721
  const responseStatus = this.safeString(order, 'status');
2703
2722
  let status = undefined;
2704
2723
  if (isActive !== undefined) {
@@ -2731,7 +2750,7 @@ export default class kucoin extends Exchange {
2731
2750
  'symbol': this.safeSymbol(marketId, market, '-'),
2732
2751
  'type': this.safeString(order, 'type'),
2733
2752
  'timeInForce': this.safeString(order, 'timeInForce'),
2734
- 'postOnly': this.safeValue(order, 'postOnly'),
2753
+ 'postOnly': this.safeBool(order, 'postOnly'),
2735
2754
  'side': this.safeString(order, 'side'),
2736
2755
  'amount': this.safeString(order, 'size'),
2737
2756
  'price': this.safeString(order, 'price'),
@@ -2871,13 +2890,13 @@ export default class kucoin extends Exchange {
2871
2890
  // ]
2872
2891
  // }
2873
2892
  //
2874
- const data = this.safeValue(response, 'data', {});
2893
+ const data = this.safeDict(response, 'data', {});
2875
2894
  let trades = undefined;
2876
2895
  if (parseResponseData) {
2877
2896
  trades = data;
2878
2897
  }
2879
2898
  else {
2880
- trades = this.safeValue(data, 'items', []);
2899
+ trades = this.safeList(data, 'items', []);
2881
2900
  }
2882
2901
  return this.parseTrades(trades, market, since, limit);
2883
2902
  }
@@ -2920,7 +2939,7 @@ export default class kucoin extends Exchange {
2920
2939
  // ]
2921
2940
  // }
2922
2941
  //
2923
- const trades = this.safeValue(response, 'data', []);
2942
+ const trades = this.safeList(response, 'data', []);
2924
2943
  return this.parseTrades(trades, market, since, limit);
2925
2944
  }
2926
2945
  parseTrade(trade, market = undefined) {
@@ -3082,8 +3101,8 @@ export default class kucoin extends Exchange {
3082
3101
  // ]
3083
3102
  // }
3084
3103
  //
3085
- const data = this.safeValue(response, 'data', []);
3086
- const first = this.safeValue(data, 0);
3104
+ const data = this.safeList(response, 'data', []);
3105
+ const first = this.safeDict(data, 0);
3087
3106
  const marketId = this.safeString(first, 'symbol');
3088
3107
  return {
3089
3108
  'info': response,
@@ -3144,7 +3163,7 @@ export default class kucoin extends Exchange {
3144
3163
  // }
3145
3164
  // }
3146
3165
  //
3147
- const data = this.safeValue(response, 'data', {});
3166
+ const data = this.safeDict(response, 'data', {});
3148
3167
  return this.parseTransaction(data, currency);
3149
3168
  }
3150
3169
  parseTransactionStatus(status) {
@@ -3244,7 +3263,7 @@ export default class kucoin extends Exchange {
3244
3263
  updated = updated * 1000;
3245
3264
  }
3246
3265
  }
3247
- const internal = this.safeValue(transaction, 'isInner');
3266
+ const internal = this.safeBool(transaction, 'isInner');
3248
3267
  const tag = this.safeString(transaction, 'memo');
3249
3268
  return {
3250
3269
  'info': transaction,
@@ -3470,7 +3489,7 @@ export default class kucoin extends Exchange {
3470
3489
  }
3471
3490
  const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
3472
3491
  const requestedType = this.safeString(params, 'type', defaultType);
3473
- const accountsByType = this.safeValue(this.options, 'accountsByType');
3492
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
3474
3493
  let type = this.safeString(accountsByType, requestedType, requestedType);
3475
3494
  params = this.omit(params, 'type');
3476
3495
  const isHf = this.safeBool(params, 'hf', false);
@@ -3552,7 +3571,7 @@ export default class kucoin extends Exchange {
3552
3571
  // }
3553
3572
  // }
3554
3573
  //
3555
- const data = this.safeValue(response, 'data', []);
3574
+ const data = this.safeList(response, 'data', []);
3556
3575
  const result = {
3557
3576
  'info': response,
3558
3577
  'timestamp': undefined,
@@ -3564,8 +3583,8 @@ export default class kucoin extends Exchange {
3564
3583
  const entry = assets[i];
3565
3584
  const marketId = this.safeString(entry, 'symbol');
3566
3585
  const symbol = this.safeSymbol(marketId, undefined, '_');
3567
- const base = this.safeValue(entry, 'baseAsset', {});
3568
- const quote = this.safeValue(entry, 'quoteAsset', {});
3586
+ const base = this.safeDict(entry, 'baseAsset', {});
3587
+ const quote = this.safeDict(entry, 'quoteAsset', {});
3569
3588
  const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
3570
3589
  const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
3571
3590
  const subResult = {};
@@ -3575,7 +3594,7 @@ export default class kucoin extends Exchange {
3575
3594
  }
3576
3595
  }
3577
3596
  else if (cross) {
3578
- const accounts = this.safeValue(data, 'accounts', []);
3597
+ const accounts = this.safeList(data, 'accounts', []);
3579
3598
  for (let i = 0; i < accounts.length; i++) {
3580
3599
  const balance = accounts[i];
3581
3600
  const currencyId = this.safeString(balance, 'currency');
@@ -3660,7 +3679,7 @@ export default class kucoin extends Exchange {
3660
3679
  // }
3661
3680
  // }
3662
3681
  //
3663
- const data = this.safeValue(response, 'data');
3682
+ const data = this.safeDict(response, 'data');
3664
3683
  return this.parseTransfer(data, currency);
3665
3684
  }
3666
3685
  else {
@@ -3692,7 +3711,7 @@ export default class kucoin extends Exchange {
3692
3711
  // }
3693
3712
  // }
3694
3713
  //
3695
- const data = this.safeValue(response, 'data');
3714
+ const data = this.safeDict(response, 'data');
3696
3715
  return this.parseTransfer(data, currency);
3697
3716
  }
3698
3717
  }
@@ -3736,7 +3755,7 @@ export default class kucoin extends Exchange {
3736
3755
  const rawStatus = this.safeString(transfer, 'status');
3737
3756
  const accountFromRaw = this.safeStringLower(transfer, 'payAccountType');
3738
3757
  const accountToRaw = this.safeStringLower(transfer, 'recAccountType');
3739
- const accountsByType = this.safeValue(this.options, 'accountsByType');
3758
+ const accountsByType = this.safeDict(this.options, 'accountsByType');
3740
3759
  const accountFrom = this.safeString(accountsByType, accountFromRaw, accountFromRaw);
3741
3760
  const accountTo = this.safeString(accountsByType, accountToRaw, accountToRaw);
3742
3761
  return {
@@ -3906,7 +3925,7 @@ export default class kucoin extends Exchange {
3906
3925
  await this.loadAccounts();
3907
3926
  let paginate = false;
3908
3927
  [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
3909
- const isHf = this.safeValue(params, 'hf');
3928
+ const isHf = this.safeBool(params, 'hf');
3910
3929
  params = this.omit(params, 'hf');
3911
3930
  if (paginate) {
3912
3931
  return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
@@ -3988,9 +4007,9 @@ export default class kucoin extends Exchange {
3988
4007
  return this.parseLedger(items, currency, since, limit);
3989
4008
  }
3990
4009
  calculateRateLimiterCost(api, method, path, params, config = {}) {
3991
- const versions = this.safeValue(this.options, 'versions', {});
3992
- const apiVersions = this.safeValue(versions, api, {});
3993
- 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, {});
3994
4013
  const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
3995
4014
  const version = this.safeString(params, 'version', defaultVersion);
3996
4015
  if (version === 'v3' && ('v3' in config)) {
@@ -4134,8 +4153,8 @@ export default class kucoin extends Exchange {
4134
4153
  // }
4135
4154
  // }
4136
4155
  //
4137
- const data = this.safeValue(response, 'data', {});
4138
- 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', []);
4139
4158
  return this.parseBorrowInterests(assets, undefined);
4140
4159
  }
4141
4160
  parseBorrowInterest(info, market = undefined) {
@@ -4188,7 +4207,7 @@ export default class kucoin extends Exchange {
4188
4207
  market = this.safeMarket(marketId, market);
4189
4208
  const symbol = this.safeString(market, 'symbol');
4190
4209
  const timestamp = this.safeInteger(info, 'createdAt');
4191
- const isolatedBase = this.safeValue(info, 'baseAsset', {});
4210
+ const isolatedBase = this.safeDict(info, 'baseAsset', {});
4192
4211
  let amountBorrowed = undefined;
4193
4212
  let interest = undefined;
4194
4213
  let currencyId = undefined;
@@ -4246,7 +4265,7 @@ export default class kucoin extends Exchange {
4246
4265
  // }
4247
4266
  // }
4248
4267
  //
4249
- const data = this.safeValue(response, 'data', {});
4268
+ const data = this.safeDict(response, 'data', {});
4250
4269
  return this.parseMarginLoan(data, currency);
4251
4270
  }
4252
4271
  async borrowIsolatedMargin(symbol, code, amount, params = {}) {
@@ -4285,7 +4304,7 @@ export default class kucoin extends Exchange {
4285
4304
  // }
4286
4305
  // }
4287
4306
  //
4288
- const data = this.safeValue(response, 'data', {});
4307
+ const data = this.safeDict(response, 'data', {});
4289
4308
  return this.parseMarginLoan(data, currency);
4290
4309
  }
4291
4310
  async repayCrossMargin(code, amount, params = {}) {
@@ -4318,7 +4337,7 @@ export default class kucoin extends Exchange {
4318
4337
  // }
4319
4338
  // }
4320
4339
  //
4321
- const data = this.safeValue(response, 'data', {});
4340
+ const data = this.safeDict(response, 'data', {});
4322
4341
  return this.parseMarginLoan(data, currency);
4323
4342
  }
4324
4343
  async repayIsolatedMargin(symbol, code, amount, params = {}) {
@@ -4355,7 +4374,7 @@ export default class kucoin extends Exchange {
4355
4374
  // }
4356
4375
  // }
4357
4376
  //
4358
- const data = this.safeValue(response, 'data', {});
4377
+ const data = this.safeDict(response, 'data', {});
4359
4378
  return this.parseMarginLoan(data, currency);
4360
4379
  }
4361
4380
  parseMarginLoan(info, currency = undefined) {
@@ -4407,7 +4426,7 @@ export default class kucoin extends Exchange {
4407
4426
  // },
4408
4427
  // ]
4409
4428
  //
4410
- const data = this.safeValue(response, 'data', []);
4429
+ const data = this.safeList(response, 'data', []);
4411
4430
  return this.parseDepositWithdrawFees(data, codes, 'currency');
4412
4431
  }
4413
4432
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
@@ -4416,9 +4435,9 @@ export default class kucoin extends Exchange {
4416
4435
  // ↑ ↑
4417
4436
  // ↑ ↑
4418
4437
  //
4419
- const versions = this.safeValue(this.options, 'versions', {});
4420
- const apiVersions = this.safeValue(versions, api, {});
4421
- 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, {});
4422
4441
  const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
4423
4442
  const version = this.safeString(params, 'version', defaultVersion);
4424
4443
  params = this.omit(params, 'version');
@@ -4443,7 +4462,8 @@ export default class kucoin extends Exchange {
4443
4462
  url = url + endpoint;
4444
4463
  const isFuturePrivate = (api === 'futuresPrivate');
4445
4464
  const isPrivate = (api === 'private');
4446
- if (isPrivate || isFuturePrivate) {
4465
+ const isBroker = (api === 'private');
4466
+ if (isPrivate || isFuturePrivate || isBroker) {
4447
4467
  this.checkRequiredCredentials();
4448
4468
  const timestamp = this.nonce().toString();
4449
4469
  headers = this.extend({
@@ -4462,7 +4482,7 @@ export default class kucoin extends Exchange {
4462
4482
  const payload = timestamp + method + endpoint + endpart;
4463
4483
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256, 'base64');
4464
4484
  headers['KC-API-SIGN'] = signature;
4465
- let partner = this.safeValue(this.options, 'partner', {});
4485
+ let partner = this.safeDict(this.options, 'partner', {});
4466
4486
  partner = isFuturePrivate ? this.safeValue(partner, 'future', partner) : this.safeValue(partner, 'spot', partner);
4467
4487
  const partnerId = this.safeString(partner, 'id');
4468
4488
  const partnerSecret = this.safeString2(partner, 'secret', 'key');
@@ -4472,6 +4492,10 @@ export default class kucoin extends Exchange {
4472
4492
  headers['KC-API-PARTNER-SIGN'] = partnerSignature;
4473
4493
  headers['KC-API-PARTNER'] = partnerId;
4474
4494
  }
4495
+ if (isBroker) {
4496
+ const brokerName = this.safeString(partner, 'name');
4497
+ headers['KC-BROKER-NAME'] = brokerName;
4498
+ }
4475
4499
  }
4476
4500
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
4477
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>;
@@ -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",
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.64",
3
+ "version": "4.2.65",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "build-docs": "node jsdoc2md.js && node examples2md.js",
37
37
  "serve-docs": "docsify serve ./wiki",
38
38
  "tsBuildFile": "tsc --skipLibCheck --strictNullChecks false --strict --noImplicitAny false --esModuleInterop --isolatedModules false --forceConsistentCasingInFileNames --removeComments false --target ES2020 --declaration --allowJs --checkJs false --moduleResolution Node --module ES2022 --outDir ./js/src --lib ES2020.BigInt --lib dom ",
39
- "tsBuild": "tsc || true",
39
+ "tsBuild": "tsc || echo \"\"",
40
40
  "tsBuildExamples": "tsc -p ./examples/tsconfig.json",
41
41
  "emitAPI": "node build/generateImplicitAPI.js",
42
42
  "build": "npm run pre-transpile && npm run transpile && npm run post-transpile && npm run update-badges && npm run build-docs",
package/skip-tests.json CHANGED
@@ -82,6 +82,18 @@
82
82
  }
83
83
  }
84
84
  },
85
+ "binanceusdm ": {
86
+ "httpsProxy": "http://5.75.153.75:8002",
87
+ "wsProxy": "http://5.75.153.75:8002",
88
+ "skipMethods": {
89
+ "watchOrderBook": {
90
+ "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269352042#L3463"
91
+ },
92
+ "watchOrderBookForSymbols": {
93
+ "spread": "same"
94
+ }
95
+ }
96
+ },
85
97
  "binanceus": {
86
98
  "skipMethods": {
87
99
  "loadMarkets": {
@@ -320,15 +332,17 @@
320
332
  },
321
333
  "fetchTickers": {
322
334
  "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269177564#L3615",
323
- "quoteVolume": "quoteVolume >= baseVolume * low is failing"
335
+ "quoteVolume": "quoteVolume >= baseVolume * low is failing",
336
+ "ask": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269331129#L3609"
324
337
  },
325
338
  "fetchTicker": {
326
- "spread": "same",
327
- "quoteVolume": "same"
339
+ "spread": "same", "quoteVolume": "same", "ask": "same"
328
340
  },
329
341
  "watchTickers": {
330
- "spread": "same",
331
- "quoteVolume": "same"
342
+ "spread": "same", "quoteVolume": "same", "ask": "same"
343
+ },
344
+ "watchTicker": {
345
+ "spread": "same", "quoteVolume": "same", "ask": "same"
332
346
  },
333
347
  "fetchOrderBook": {
334
348
  "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269177564#L3946"
@@ -601,7 +615,13 @@
601
615
  "fetchOpenInterestHistory": {
602
616
  "openInterestAmount": "openInterestAmount is not provided"
603
617
  },
604
- "fetchBorrowRate": "does not work with unified account"
618
+ "fetchBorrowRate": "does not work with unified account",
619
+ "watchOrderBook": {
620
+ "spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269352042#L3669"
621
+ },
622
+ "watchOrderBookForSymbols": {
623
+ "spread": "same"
624
+ }
605
625
  }
606
626
  },
607
627
  "bigone": {
@@ -1163,9 +1183,7 @@
1163
1183
  "watchTrades": {
1164
1184
  "timestamp": "ts several hours ahead in in future :)"
1165
1185
  },
1166
- "watchOHLCV": {
1167
- "0": "ts several hours ahead in in future :)"
1168
- }
1186
+ "watchOHLCV": "some timestamp issues"
1169
1187
  }
1170
1188
  },
1171
1189
  "lykke": {
@@ -1356,12 +1374,16 @@
1356
1374
  "deposit":"not provided"
1357
1375
  },
1358
1376
  "fetchTickers": {
1359
- "quoteVolume": "quoteVolume >= baseVolume * low is failing",
1360
- "baseVolume": "quoteVolume >= baseVolume * low is failing"
1377
+ "quoteVolume": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269352042#L3690"
1361
1378
  },
1362
1379
  "fetchTicker": {
1363
- "quoteVolume": "quoteVolume >= baseVolume * low is failing",
1364
- "baseVolume": "quoteVolume >= baseVolume * low is failing"
1380
+ "quoteVolume": "same"
1381
+ },
1382
+ "watchTickers": {
1383
+ "quoteVolume": "same"
1384
+ },
1385
+ "watchTicker": {
1386
+ "quoteVolume": "same"
1365
1387
  },
1366
1388
  "watchOrderBook": {
1367
1389
  "nonce": "missing https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L4807"