ccxt 4.0.80 → 4.0.81

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 (46) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/README.md +3 -3
  3. package/dist/ccxt.browser.js +211 -116
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/binance.js +9 -0
  7. package/dist/cjs/src/bitget.js +9 -4
  8. package/dist/cjs/src/bitmex.js +3 -1
  9. package/dist/cjs/src/bybit.js +0 -9
  10. package/dist/cjs/src/delta.js +3 -0
  11. package/dist/cjs/src/exmo.js +64 -25
  12. package/dist/cjs/src/gate.js +2 -0
  13. package/dist/cjs/src/hitbtc.js +3 -1
  14. package/dist/cjs/src/huobi.js +2 -0
  15. package/dist/cjs/src/kucoin.js +96 -69
  16. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  17. package/dist/cjs/src/pro/okx.js +8 -3
  18. package/dist/cjs/src/pro/probit.js +2 -2
  19. package/dist/cjs/src/upbit.js +8 -0
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/binance.d.ts +9 -0
  23. package/js/src/abstract/binancecoinm.d.ts +9 -0
  24. package/js/src/abstract/binanceus.d.ts +9 -0
  25. package/js/src/abstract/binanceusdm.d.ts +9 -0
  26. package/js/src/abstract/gate.d.ts +2 -0
  27. package/js/src/abstract/gateio.d.ts +2 -0
  28. package/js/src/abstract/huobi.d.ts +2 -0
  29. package/js/src/abstract/huobipro.d.ts +2 -0
  30. package/js/src/binance.js +9 -0
  31. package/js/src/bitget.js +9 -4
  32. package/js/src/bitmex.d.ts +1 -1
  33. package/js/src/bitmex.js +3 -1
  34. package/js/src/bybit.js +0 -9
  35. package/js/src/delta.js +3 -0
  36. package/js/src/exmo.js +64 -25
  37. package/js/src/gate.js +2 -0
  38. package/js/src/hitbtc.js +3 -1
  39. package/js/src/huobi.js +2 -0
  40. package/js/src/kucoin.js +96 -69
  41. package/js/src/pro/krakenfutures.js +1 -1
  42. package/js/src/pro/okx.js +8 -3
  43. package/js/src/pro/probit.js +2 -2
  44. package/js/src/upbit.js +9 -1
  45. package/package.json +1 -1
  46. package/skip-tests.json +7 -2
@@ -59,6 +59,12 @@ interface binance {
59
59
  sapiGetLoanLoanableData(params?: {}): Promise<implicitReturnType>;
60
60
  sapiGetLoanCollateralData(params?: {}): Promise<implicitReturnType>;
61
61
  sapiGetLoanRepayCollateralRate(params?: {}): Promise<implicitReturnType>;
62
+ sapiGetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
+ sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
64
+ sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
65
+ sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
66
+ sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
67
+ sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
62
68
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
69
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
64
70
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -300,6 +306,9 @@ interface binance {
300
306
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
301
307
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
302
308
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
309
+ sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
310
+ sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
311
+ sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
303
312
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
304
313
  sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
305
314
  sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
@@ -59,6 +59,12 @@ interface binance {
59
59
  sapiGetLoanLoanableData(params?: {}): Promise<implicitReturnType>;
60
60
  sapiGetLoanCollateralData(params?: {}): Promise<implicitReturnType>;
61
61
  sapiGetLoanRepayCollateralRate(params?: {}): Promise<implicitReturnType>;
62
+ sapiGetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
+ sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
64
+ sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
65
+ sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
66
+ sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
67
+ sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
62
68
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
69
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
64
70
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -300,6 +306,9 @@ interface binance {
300
306
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
301
307
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
302
308
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
309
+ sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
310
+ sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
311
+ sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
303
312
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
304
313
  sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
305
314
  sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
@@ -59,6 +59,12 @@ interface binance {
59
59
  sapiGetLoanLoanableData(params?: {}): Promise<implicitReturnType>;
60
60
  sapiGetLoanCollateralData(params?: {}): Promise<implicitReturnType>;
61
61
  sapiGetLoanRepayCollateralRate(params?: {}): Promise<implicitReturnType>;
62
+ sapiGetLoanFlexibleOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
+ sapiGetLoanFlexibleBorrowHistory(params?: {}): Promise<implicitReturnType>;
64
+ sapiGetLoanFlexibleRepayHistory(params?: {}): Promise<implicitReturnType>;
65
+ sapiGetLoanFlexibleLtvAdjustmentHistory(params?: {}): Promise<implicitReturnType>;
66
+ sapiGetLoanFlexibleLoanableData(params?: {}): Promise<implicitReturnType>;
67
+ sapiGetLoanFlexibleCollateralData(params?: {}): Promise<implicitReturnType>;
62
68
  sapiGetLoanVipOngoingOrders(params?: {}): Promise<implicitReturnType>;
63
69
  sapiGetLoanVipRepayHistory(params?: {}): Promise<implicitReturnType>;
64
70
  sapiGetLoanVipCollateralAccount(params?: {}): Promise<implicitReturnType>;
@@ -300,6 +306,9 @@ interface binance {
300
306
  sapiPostLoanRepay(params?: {}): Promise<implicitReturnType>;
301
307
  sapiPostLoanAdjustLtv(params?: {}): Promise<implicitReturnType>;
302
308
  sapiPostLoanCustomizeMarginCall(params?: {}): Promise<implicitReturnType>;
309
+ sapiPostLoanFlexibleBorrow(params?: {}): Promise<implicitReturnType>;
310
+ sapiPostLoanFlexibleRepay(params?: {}): Promise<implicitReturnType>;
311
+ sapiPostLoanFlexibleAdjustLtv(params?: {}): Promise<implicitReturnType>;
303
312
  sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
304
313
  sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
305
314
  sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
@@ -79,6 +79,8 @@ interface Exchange {
79
79
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
80
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
81
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
+ privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
83
+ privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
82
84
  privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
83
85
  privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
84
86
  privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
@@ -79,6 +79,8 @@ interface gate {
79
79
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
80
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
81
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
+ privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
83
+ privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
82
84
  privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
83
85
  privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
84
86
  privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
@@ -320,6 +320,7 @@ interface Exchange {
320
320
  contractPrivateGetLinearSwapApiV3UnifiedAccountInfo(params?: {}): Promise<implicitReturnType>;
321
321
  contractPrivateGetLinearSwapApiV3FixPositionMarginChangeRecord(params?: {}): Promise<implicitReturnType>;
322
322
  contractPrivateGetLinearSwapApiV3SwapUnifiedAccountType(params?: {}): Promise<implicitReturnType>;
323
+ contractPrivateGetLinearSwapApiV3LinearSwapOverviewAccountInfo(params?: {}): Promise<implicitReturnType>;
323
324
  contractPrivatePostApiV1ContractBalanceValuation(params?: {}): Promise<implicitReturnType>;
324
325
  contractPrivatePostApiV1ContractAccountInfo(params?: {}): Promise<implicitReturnType>;
325
326
  contractPrivatePostApiV1ContractPositionInfo(params?: {}): Promise<implicitReturnType>;
@@ -504,6 +505,7 @@ interface Exchange {
504
505
  contractPrivatePostLinearSwapApiV3SwapCrossHisordersExact(params?: {}): Promise<implicitReturnType>;
505
506
  contractPrivatePostLinearSwapApiV3FixPositionMarginChange(params?: {}): Promise<implicitReturnType>;
506
507
  contractPrivatePostLinearSwapApiV3SwapSwitchAccountType(params?: {}): Promise<implicitReturnType>;
508
+ contractPrivatePostLinearSwapApiV3LinearSwapFeeSwitch(params?: {}): Promise<implicitReturnType>;
507
509
  contractPrivatePostLinearSwapApiV1SwapTriggerOrder(params?: {}): Promise<implicitReturnType>;
508
510
  contractPrivatePostLinearSwapApiV1SwapCrossTriggerOrder(params?: {}): Promise<implicitReturnType>;
509
511
  contractPrivatePostLinearSwapApiV1SwapTriggerCancel(params?: {}): Promise<implicitReturnType>;
@@ -320,6 +320,7 @@ interface huobi {
320
320
  contractPrivateGetLinearSwapApiV3UnifiedAccountInfo(params?: {}): Promise<implicitReturnType>;
321
321
  contractPrivateGetLinearSwapApiV3FixPositionMarginChangeRecord(params?: {}): Promise<implicitReturnType>;
322
322
  contractPrivateGetLinearSwapApiV3SwapUnifiedAccountType(params?: {}): Promise<implicitReturnType>;
323
+ contractPrivateGetLinearSwapApiV3LinearSwapOverviewAccountInfo(params?: {}): Promise<implicitReturnType>;
323
324
  contractPrivatePostApiV1ContractBalanceValuation(params?: {}): Promise<implicitReturnType>;
324
325
  contractPrivatePostApiV1ContractAccountInfo(params?: {}): Promise<implicitReturnType>;
325
326
  contractPrivatePostApiV1ContractPositionInfo(params?: {}): Promise<implicitReturnType>;
@@ -504,6 +505,7 @@ interface huobi {
504
505
  contractPrivatePostLinearSwapApiV3SwapCrossHisordersExact(params?: {}): Promise<implicitReturnType>;
505
506
  contractPrivatePostLinearSwapApiV3FixPositionMarginChange(params?: {}): Promise<implicitReturnType>;
506
507
  contractPrivatePostLinearSwapApiV3SwapSwitchAccountType(params?: {}): Promise<implicitReturnType>;
508
+ contractPrivatePostLinearSwapApiV3LinearSwapFeeSwitch(params?: {}): Promise<implicitReturnType>;
507
509
  contractPrivatePostLinearSwapApiV1SwapTriggerOrder(params?: {}): Promise<implicitReturnType>;
508
510
  contractPrivatePostLinearSwapApiV1SwapCrossTriggerOrder(params?: {}): Promise<implicitReturnType>;
509
511
  contractPrivatePostLinearSwapApiV1SwapTriggerCancel(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -255,6 +255,12 @@ export default class binance extends Exchange {
255
255
  'loan/loanable/data': 40,
256
256
  'loan/collateral/data': 40,
257
257
  'loan/repay/collateral/rate': 600,
258
+ 'loan/flexible/ongoing/orders': 30,
259
+ 'loan/flexible/borrow/history': 40,
260
+ 'loan/flexible/repay/history': 40,
261
+ 'loan/flexible/ltv/adjustment/history': 40,
262
+ 'loan/flexible/loanable/data': 40,
263
+ 'loan/flexible/collateral/data': 40,
258
264
  'loan/vip/ongoing/orders': 40,
259
265
  'loan/vip/repay/history': 40,
260
266
  'loan/vip/collateral/account': 600,
@@ -520,6 +526,9 @@ export default class binance extends Exchange {
520
526
  'loan/repay': 40.002,
521
527
  'loan/adjust/ltv': 40.002,
522
528
  'loan/customize/margin_call': 40.002,
529
+ 'loan/flexible/borrow': 40.002,
530
+ 'loan/flexible/repay': 40.002,
531
+ 'loan/flexible/adjust/ltv': 40.002,
523
532
  'loan/vip/repay': 40.002,
524
533
  'convert/getQuote': 1.3334,
525
534
  'convert/acceptQuote': 3.3335,
package/js/src/bitget.js CHANGED
@@ -3841,6 +3841,8 @@ export default class bitget extends Exchange {
3841
3841
  * @method
3842
3842
  * @name bitget#fetchMyTrades
3843
3843
  * @description fetch all trades made by the user
3844
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-transaction-details
3845
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail
3844
3846
  * @param {string} symbol unified market symbol
3845
3847
  * @param {int} [since] the earliest time in ms to fetch trades for
3846
3848
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -3850,16 +3852,19 @@ export default class bitget extends Exchange {
3850
3852
  this.checkRequiredSymbol('fetchMyTrades', symbol);
3851
3853
  await this.loadMarkets();
3852
3854
  const market = this.market(symbol);
3853
- if (market['swap']) {
3854
- throw new BadSymbol(this.id + ' fetchMyTrades() only supports spot markets');
3855
- }
3856
3855
  const request = {
3857
3856
  'symbol': market['id'],
3858
3857
  };
3859
3858
  if (limit !== undefined) {
3860
3859
  request['limit'] = limit;
3861
3860
  }
3862
- const response = await this.privateSpotPostTradeFills(this.extend(request, params));
3861
+ let response = undefined;
3862
+ if (market['spot']) {
3863
+ response = await this.privateSpotPostTradeFills(this.extend(request, params));
3864
+ }
3865
+ else {
3866
+ response = await this.privateMixGetOrderFills(this.extend(request, params));
3867
+ }
3863
3868
  //
3864
3869
  // {
3865
3870
  // code: '00000',
@@ -112,7 +112,7 @@ export default class bitmex extends Exchange {
112
112
  rate: any;
113
113
  };
114
114
  }>;
115
- fetchFundingRates(symbols?: string[], params?: {}): Promise<{}>;
115
+ fetchFundingRates(symbols?: string[], params?: {}): Promise<any>;
116
116
  parseFundingRate(contract: any, market?: any): {
117
117
  info: any;
118
118
  symbol: any;
package/js/src/bitmex.js CHANGED
@@ -2277,7 +2277,9 @@ export default class bitmex extends Exchange {
2277
2277
  filteredResponse.push(item);
2278
2278
  }
2279
2279
  }
2280
- return this.parseFundingRates(filteredResponse, symbols);
2280
+ symbols = this.marketSymbols(symbols);
2281
+ const result = this.parseFundingRates(filteredResponse);
2282
+ return this.filterByArray(result, 'symbol', symbols);
2281
2283
  }
2282
2284
  parseFundingRate(contract, market = undefined) {
2283
2285
  // see response sample under "fetchMarkets" because same endpoint is being used here
package/js/src/bybit.js CHANGED
@@ -4447,9 +4447,6 @@ export default class bybit extends Exchange {
4447
4447
  return this.parseOrder(order);
4448
4448
  }
4449
4449
  async editUnifiedAccountOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4450
- if (amount === undefined && price === undefined) {
4451
- throw new InvalidOrder(this.id + ' editOrder requires either a price argument or an amount argument');
4452
- }
4453
4450
  await this.loadMarkets();
4454
4451
  const market = this.market(symbol);
4455
4452
  if (!market['linear'] && !market['option']) {
@@ -4528,9 +4525,6 @@ export default class bybit extends Exchange {
4528
4525
  });
4529
4526
  }
4530
4527
  async editUnifiedMarginOrder(id, symbol, type, side, amount, price = undefined, params = {}) {
4531
- if (amount === undefined && price === undefined) {
4532
- throw new InvalidOrder(this.id + ' editOrder requires either a price argument or an amount argument');
4533
- }
4534
4528
  await this.loadMarkets();
4535
4529
  const market = this.market(symbol);
4536
4530
  if (!market['linear'] && !market['option']) {
@@ -4627,9 +4621,6 @@ export default class bybit extends Exchange {
4627
4621
  return this.parseOrder(order);
4628
4622
  }
4629
4623
  async editContractV3Order(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4630
- if (amount === undefined && price === undefined) {
4631
- throw new InvalidOrder(this.id + ' editOrder requires either a price argument or an amount argument');
4632
- }
4633
4624
  await this.loadMarkets();
4634
4625
  const market = this.market(symbol);
4635
4626
  const request = {
package/js/src/delta.js CHANGED
@@ -707,6 +707,9 @@ export default class delta extends Exchange {
707
707
  for (let i = 0; i < markets.length; i++) {
708
708
  const market = markets[i];
709
709
  let type = this.safeString(market, 'contract_type');
710
+ if (type === 'options_combos') {
711
+ continue;
712
+ }
710
713
  // const settlingAsset = this.safeValue (market, 'settling_asset', {});
711
714
  const quotingAsset = this.safeValue(market, 'quoting_asset', {});
712
715
  const underlyingAsset = this.safeValue(market, 'underlying_asset', {});
package/js/src/exmo.js CHANGED
@@ -874,20 +874,36 @@ export default class exmo extends Exchange {
874
874
  }
875
875
  parseBalance(response) {
876
876
  const result = { 'info': response };
877
- const free = this.safeValue(response, 'balances', {});
878
- const used = this.safeValue(response, 'reserved', {});
879
- const currencyIds = Object.keys(free);
880
- for (let i = 0; i < currencyIds.length; i++) {
881
- const currencyId = currencyIds[i];
882
- const code = this.safeCurrencyCode(currencyId);
883
- const account = this.account();
884
- if (currencyId in free) {
885
- account['free'] = this.safeString(free, currencyId);
877
+ const wallets = this.safeValue(response, 'wallets');
878
+ if (wallets !== undefined) {
879
+ const currencyIds = Object.keys(wallets);
880
+ for (let i = 0; i < currencyIds.length; i++) {
881
+ const currencyId = currencyIds[i];
882
+ const item = wallets[currencyId];
883
+ const currency = this.safeCurrencyCode(currencyId);
884
+ const account = this.account();
885
+ account['used'] = this.safeString(item, 'used');
886
+ account['free'] = this.safeString(item, 'free');
887
+ account['total'] = this.safeString(item, 'balance');
888
+ result[currency] = account;
886
889
  }
887
- if (currencyId in used) {
888
- account['used'] = this.safeString(used, currencyId);
890
+ }
891
+ else {
892
+ const free = this.safeValue(response, 'balances', {});
893
+ const used = this.safeValue(response, 'reserved', {});
894
+ const currencyIds = Object.keys(free);
895
+ for (let i = 0; i < currencyIds.length; i++) {
896
+ const currencyId = currencyIds[i];
897
+ const code = this.safeCurrencyCode(currencyId);
898
+ const account = this.account();
899
+ if (currencyId in free) {
900
+ account['free'] = this.safeString(free, currencyId);
901
+ }
902
+ if (currencyId in used) {
903
+ account['used'] = this.safeString(used, currencyId);
904
+ }
905
+ result[code] = account;
889
906
  }
890
- result[code] = account;
891
907
  }
892
908
  return this.safeBalance(result);
893
909
  }
@@ -897,22 +913,45 @@ export default class exmo extends Exchange {
897
913
  * @name exmo#fetchBalance
898
914
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
899
915
  * @param {object} [params] extra parameters specific to the exmo api endpoint
916
+ * @param {string} [params.marginMode] *isolated* fetches the isolated margin balance
900
917
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
901
918
  */
902
919
  await this.loadMarkets();
903
- const response = await this.privatePostUserInfo(params);
904
- //
905
- // {
906
- // "uid":131685,
907
- // "server_date":1628999600,
908
- // "balances":{
909
- // "EXM":"0",
910
- // "USD":"0",
911
- // "EUR":"0",
912
- // "GBP":"0",
913
- // },
914
- // }
915
- //
920
+ let marginMode = undefined;
921
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
922
+ if (marginMode === 'cross') {
923
+ throw new BadRequest(this.id + ' does not support cross margin');
924
+ }
925
+ let response = undefined;
926
+ if (marginMode === 'isolated') {
927
+ response = await this.privatePostMarginUserWalletList(params);
928
+ //
929
+ // {
930
+ // "wallets": {
931
+ // "USD": {
932
+ // "balance": "1000",
933
+ // "free": "600",
934
+ // "used": "400"
935
+ // }
936
+ // }
937
+ // }
938
+ //
939
+ }
940
+ else {
941
+ response = await this.privatePostUserInfo(params);
942
+ //
943
+ // {
944
+ // "uid":131685,
945
+ // "server_date":1628999600,
946
+ // "balances":{
947
+ // "EXM":"0",
948
+ // "USD":"0",
949
+ // "EUR":"0",
950
+ // "GBP":"0",
951
+ // },
952
+ // }
953
+ //
954
+ }
916
955
  return this.parseBalance(response);
917
956
  }
918
957
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
package/js/src/gate.js CHANGED
@@ -282,6 +282,8 @@ export default class gate extends Exchange {
282
282
  },
283
283
  'portfolio': {
284
284
  'get': {
285
+ 'spot/currency_pairs': 1.5,
286
+ 'spot/currency_pairs/{currency_pair}': 1.5,
285
287
  'accounts': 1.5,
286
288
  'account_mode': 1.5,
287
289
  'borrowable': 1.5,
package/js/src/hitbtc.js CHANGED
@@ -592,7 +592,6 @@ export default class hitbtc extends Exchange {
592
592
  'STEPN': 'GMT',
593
593
  'STX': 'STOX',
594
594
  'TV': 'Tokenville',
595
- 'USD': 'USDT',
596
595
  'XMT': 'MTL',
597
596
  'XPNT': 'PNT',
598
597
  },
@@ -644,6 +643,9 @@ export default class hitbtc extends Exchange {
644
643
  const ids = Object.keys(response);
645
644
  for (let i = 0; i < ids.length; i++) {
646
645
  const id = ids[i];
646
+ if (id.endsWith('_BQX')) {
647
+ continue; // seems like an invalid symbol and if we try to access it individually we get: {"timestamp":"2023-09-02T14:38:20.351Z","error":{"description":"Try get /public/symbol, to get list of all available symbols.","code":2001,"message":"No such symbol: EOSUSD_BQX"},"path":"/api/3/public/symbol/EOSUSD_BQX","requestId":"e1e9fce6-16374591"}
648
+ }
647
649
  const market = this.safeValue(response, id);
648
650
  const marketType = this.safeString(market, 'type');
649
651
  const expiry = this.safeInteger(market, 'expiry');
package/js/src/huobi.js CHANGED
@@ -605,6 +605,7 @@ export default class huobi extends Exchange {
605
605
  'linear-swap-api/v3/unified_account_info': 1,
606
606
  'linear-swap-api/v3/fix_position_margin_change_record': 1,
607
607
  'linear-swap-api/v3/swap_unified_account_type': 1,
608
+ 'linear-swap-api/v3/linear_swap_overview_account_info': 1,
608
609
  },
609
610
  'post': {
610
611
  // Future Account Interface
@@ -799,6 +800,7 @@ export default class huobi extends Exchange {
799
800
  'linear-swap-api/v3/swap_cross_hisorders_exact': 1,
800
801
  'linear-swap-api/v3/fix_position_margin_change': 1,
801
802
  'linear-swap-api/v3/swap_switch_account_type': 1,
803
+ 'linear-swap-api/v3/linear_swap_fee_switch': 1,
802
804
  // Swap Strategy Order Interface
803
805
  'linear-swap-api/v1/swap_trigger_order': 1,
804
806
  'linear-swap-api/v1/swap_cross_trigger_order': 1,
package/js/src/kucoin.js CHANGED
@@ -495,6 +495,7 @@ export default class kucoin extends Exchange {
495
495
  'versions': {
496
496
  'public': {
497
497
  'GET': {
498
+ 'currencies': 'v3',
498
499
  'currencies/{currency}': 'v2',
499
500
  'status': 'v1',
500
501
  'market/orderbook/level2_20': 'v1',
@@ -1000,19 +1001,34 @@ export default class kucoin extends Exchange {
1000
1001
  const promises = [];
1001
1002
  promises.push(this.publicGetCurrencies(params));
1002
1003
  //
1003
- // {
1004
- // "currency": "OMG",
1005
- // "name": "OMG",
1006
- // "fullName": "OmiseGO",
1007
- // "precision": 8,
1008
- // "confirms": 12,
1009
- // "withdrawalMinSize": "4",
1010
- // "withdrawalMinFee": "1.25",
1011
- // "isWithdrawEnabled": false,
1012
- // "isDepositEnabled": false,
1013
- // "isMarginEnabled": false,
1014
- // "isDebitEnabled": false
1015
- // }
1004
+ // {
1005
+ // "code":"200000",
1006
+ // "data":[
1007
+ // {
1008
+ // "currency":"CSP",
1009
+ // "name":"CSP",
1010
+ // "fullName":"Caspian",
1011
+ // "precision":8,
1012
+ // "confirms":null,
1013
+ // "contractAddress":null,
1014
+ // "isMarginEnabled":false,
1015
+ // "isDebitEnabled":false,
1016
+ // "chains":[
1017
+ // {
1018
+ // "chainName":"ERC20",
1019
+ // "chain":"eth",
1020
+ // "withdrawalMinSize":"2999",
1021
+ // "withdrawalMinFee":"2999",
1022
+ // "isWithdrawEnabled":false,
1023
+ // "isDepositEnabled":false,
1024
+ // "confirms":12,
1025
+ // "preConfirms":12,
1026
+ // "contractAddress":"0xa6446d655a0c34bc4f05042ee88170d056cbaf45",
1027
+ // "depositFeeRate": "0.001", // present for some currencies/networks
1028
+ // }
1029
+ // ]
1030
+ // },
1031
+ // }
1016
1032
  //
1017
1033
  promises.push(this.fetchWebEndpoint('fetchCurrencies', 'webExchangeGetCurrencyCurrencyChainInfo', true));
1018
1034
  //
@@ -1023,90 +1039,101 @@ export default class kucoin extends Exchange {
1023
1039
  // "retry": false,
1024
1040
  // "data": [
1025
1041
  // {
1026
- // "withdrawMinFee": "0.0005",
1027
- // "chainName": "BTC",
1028
- // "preDepositTipEnabled": "false",
1029
- // "chain": "btc",
1042
+ // "status": "enabled",
1043
+ // "currency": "BTC",
1030
1044
  // "isChainEnabled": "true",
1031
- // "withdrawDisabledTip": "",
1032
- // "walletPrecision": "8",
1045
+ // "chain": "btc",
1046
+ // "chainName": "BTC",
1033
1047
  // "chainFullName": "Bitcoin",
1034
- // "orgAddress": "",
1048
+ // "walletPrecision": "8",
1035
1049
  // "isDepositEnabled": "true",
1036
- // "withdrawMinSize": "0.001",
1037
- // "depositDisabledTip": "",
1038
- // "userAddressName": "",
1039
- // "txUrl": "https://blockchain.info/tx/{txId}",
1040
- // "preWithdrawTipEnabled": "false",
1041
- // "withdrawFeeRate": "0",
1042
- // "confirmationCount": "2",
1043
- // "currency": "BTC",
1044
1050
  // "depositMinSize": "0.00005",
1051
+ // "confirmationCount": "2",
1045
1052
  // "isWithdrawEnabled": "true",
1046
- // "preDepositTip": "",
1053
+ // "withdrawMinSize": "0.001",
1054
+ // "withdrawMinFee": "0.0005",
1055
+ // "withdrawFeeRate": "0",
1056
+ // "depositDisabledTip": "Wallet Maintenance",
1057
+ // "preDepositTipEnabled": "true",
1058
+ // "preDepositTip": "Do not transfer from ETH network directly",
1059
+ // "withdrawDisabledTip": "",
1060
+ // "preWithdrawTipEnabled": "false",
1047
1061
  // "preWithdrawTip": "",
1048
- // "status": "enabled"
1062
+ // "orgAddress": "",
1063
+ // "userAddressName": "Memo",
1049
1064
  // },
1050
1065
  // ]
1051
1066
  // }
1052
1067
  //
1053
1068
  const responses = await Promise.all(promises);
1054
- const responseCurrencies = responses[0];
1055
- const responseChains = responses[1];
1056
- const data = this.safeValue(responseCurrencies, 'data', []);
1057
- const chainsData = this.safeValue(responseChains, 'data', []);
1058
- const currencyChains = this.groupBy(chainsData, 'currency');
1069
+ const currenciesResponse = this.safeValue(responses, 0, {});
1070
+ const currenciesData = this.safeValue(currenciesResponse, 'data', []);
1071
+ const additionalResponse = this.safeValue(responses, 1, {});
1072
+ const additionalData = this.safeValue(additionalResponse, 'data', []);
1073
+ const additionalDataGrouped = this.groupBy(additionalData, 'currency');
1059
1074
  const result = {};
1060
- for (let i = 0; i < data.length; i++) {
1061
- const entry = data[i];
1075
+ for (let i = 0; i < currenciesData.length; i++) {
1076
+ const entry = currenciesData[i];
1062
1077
  const id = this.safeString(entry, 'currency');
1063
1078
  const name = this.safeString(entry, 'fullName');
1064
1079
  const code = this.safeCurrencyCode(id);
1065
- const isWithdrawEnabled = this.safeValue(entry, 'isWithdrawEnabled', false);
1066
- const isDepositEnabled = this.safeValue(entry, 'isDepositEnabled', false);
1067
- const fee = this.safeNumber(entry, 'withdrawalMinFee');
1068
- const active = (isWithdrawEnabled && isDepositEnabled);
1080
+ let isWithdrawEnabled = undefined;
1081
+ let isDepositEnabled = undefined;
1069
1082
  const networks = {};
1070
- const chains = this.safeValue(currencyChains, id, []);
1083
+ const chains = this.safeValue(entry, 'chains', []);
1084
+ const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
1085
+ const precision = this.parseNumber(this.parsePrecision(this.safeString(entry, 'precision')));
1071
1086
  for (let j = 0; j < chains.length; j++) {
1072
1087
  const chain = chains[j];
1073
1088
  const chainId = this.safeString(chain, 'chain');
1074
- const isChainEnabled = this.safeString(chain, 'isChainEnabled'); // better than 'status'
1075
- if (isChainEnabled === 'true') {
1076
- const networkCode = this.networkIdToCode(chainId);
1077
- const chainWithdrawEnabled = this.safeValue(chain, 'isWithdrawEnabled', false);
1078
- const chainDepositEnabled = this.safeValue(chain, 'isDepositEnabled', false);
1079
- networks[networkCode] = {
1080
- 'info': chain,
1081
- 'id': chainId,
1082
- 'name': this.safeString2(chain, 'chainFullName', 'chainName'),
1083
- 'code': networkCode,
1084
- 'active': chainWithdrawEnabled && chainDepositEnabled,
1085
- 'fee': this.safeNumber(chain, 'withdrawMinFee'),
1086
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'walletPrecision'))),
1087
- 'limits': {
1088
- 'withdraw': {
1089
- 'min': this.safeNumber(chain, 'withdrawMinSize'),
1090
- 'max': undefined,
1091
- },
1092
- 'deposit': {
1093
- 'min': this.safeNumber(chain, 'depositMinSize'),
1094
- 'max': undefined,
1095
- },
1096
- },
1097
- };
1089
+ const networkCode = this.networkIdToCode(chainId);
1090
+ const chainWithdrawEnabled = this.safeValue(chain, 'isWithdrawEnabled', false);
1091
+ if (isWithdrawEnabled === undefined) {
1092
+ isWithdrawEnabled = chainWithdrawEnabled;
1098
1093
  }
1094
+ else {
1095
+ isWithdrawEnabled = isWithdrawEnabled || chainWithdrawEnabled;
1096
+ }
1097
+ const chainDepositEnabled = this.safeValue(chain, 'isDepositEnabled', false);
1098
+ if (isDepositEnabled === undefined) {
1099
+ isDepositEnabled = chainDepositEnabled;
1100
+ }
1101
+ else {
1102
+ isDepositEnabled = isDepositEnabled || chainDepositEnabled;
1103
+ }
1104
+ const chainExtraData = this.safeValue(extraChainsData, chainId, {});
1105
+ networks[networkCode] = {
1106
+ 'info': chain,
1107
+ 'id': chainId,
1108
+ 'name': this.safeString(chain, 'chainName'),
1109
+ 'code': networkCode,
1110
+ 'active': chainWithdrawEnabled && chainDepositEnabled,
1111
+ 'fee': this.safeNumber(chain, 'withdrawalMinFee'),
1112
+ 'deposit': chainDepositEnabled,
1113
+ 'withdraw': chainWithdrawEnabled,
1114
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainExtraData, 'walletPrecision'))),
1115
+ 'limits': {
1116
+ 'withdraw': {
1117
+ 'min': this.safeNumber(chain, 'withdrawalMinSize'),
1118
+ 'max': undefined,
1119
+ },
1120
+ 'deposit': {
1121
+ 'min': this.safeNumber(chainExtraData, 'depositMinSize'),
1122
+ 'max': undefined,
1123
+ },
1124
+ },
1125
+ };
1099
1126
  }
1100
1127
  result[code] = {
1101
1128
  'id': id,
1102
1129
  'name': name,
1103
1130
  'code': code,
1104
- 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'precision'))),
1131
+ 'precision': precision,
1105
1132
  'info': entry,
1106
- 'active': active,
1133
+ 'active': (isDepositEnabled || isWithdrawEnabled),
1107
1134
  'deposit': isDepositEnabled,
1108
1135
  'withdraw': isWithdrawEnabled,
1109
- 'fee': fee,
1136
+ 'fee': undefined,
1110
1137
  'limits': this.limits,
1111
1138
  'networks': networks,
1112
1139
  };
@@ -624,7 +624,7 @@ export default class krakenfutures extends krakenfuturesRest {
624
624
  symbols[symbol] = true;
625
625
  cachedOrders.append(parsed);
626
626
  }
627
- if (this.orders.length > 0) {
627
+ if (this.orders.length) {
628
628
  client.resolve(this.orders, 'orders');
629
629
  const keys = Object.keys(symbols);
630
630
  for (let i = 0; i < keys.length; i++) {