ccxt 4.4.78 → 4.4.82

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 (99) hide show
  1. package/README.md +8 -12
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/apex.js +21 -31
  5. package/dist/cjs/src/ascendex.js +26 -5
  6. package/dist/cjs/src/base/Exchange.js +26 -3
  7. package/dist/cjs/src/base/functions/encode.js +1 -1
  8. package/dist/cjs/src/bigone.js +22 -14
  9. package/dist/cjs/src/binance.js +8 -0
  10. package/dist/cjs/src/bingx.js +16 -40
  11. package/dist/cjs/src/bitfinex.js +128 -88
  12. package/dist/cjs/src/bitget.js +60 -71
  13. package/dist/cjs/src/bitmart.js +7 -2
  14. package/dist/cjs/src/bitmex.js +12 -4
  15. package/dist/cjs/src/bitopro.js +5 -1
  16. package/dist/cjs/src/bitrue.js +2 -1
  17. package/dist/cjs/src/bitso.js +1 -1
  18. package/dist/cjs/src/bitteam.js +2 -0
  19. package/dist/cjs/src/bitvavo.js +28 -10
  20. package/dist/cjs/src/btcalpha.js +1 -1
  21. package/dist/cjs/src/btcmarkets.js +1 -1
  22. package/dist/cjs/src/btcturk.js +1 -1
  23. package/dist/cjs/src/bybit.js +34 -16
  24. package/dist/cjs/src/coinbase.js +4 -17
  25. package/dist/cjs/src/coinex.js +1 -0
  26. package/dist/cjs/src/coinlist.js +1 -0
  27. package/dist/cjs/src/coinone.js +1 -0
  28. package/dist/cjs/src/delta.js +4 -0
  29. package/dist/cjs/src/deribit.js +1 -0
  30. package/dist/cjs/src/hollaex.js +1 -0
  31. package/dist/cjs/src/htx.js +9 -5
  32. package/dist/cjs/src/huobijp.js +1 -0
  33. package/dist/cjs/src/hyperliquid.js +16 -0
  34. package/dist/cjs/src/kraken.js +2 -0
  35. package/dist/cjs/src/okx.js +2 -3
  36. package/dist/cjs/src/oxfun.js +21 -1
  37. package/dist/cjs/src/poloniex.js +1 -0
  38. package/dist/cjs/src/pro/binance.js +3 -3
  39. package/dist/cjs/src/pro/coinbase.js +43 -62
  40. package/dist/cjs/src/pro/hyperliquid.js +10 -2
  41. package/dist/cjs/src/pro/upbit.js +43 -0
  42. package/dist/cjs/src/timex.js +2 -2
  43. package/dist/cjs/src/upbit.js +43 -21
  44. package/dist/cjs/src/whitebit.js +65 -12
  45. package/js/ccxt.d.ts +1 -1
  46. package/js/ccxt.js +1 -1
  47. package/js/src/abstract/bitmart.d.ts +1 -0
  48. package/js/src/apex.js +21 -31
  49. package/js/src/ascendex.js +26 -5
  50. package/js/src/base/Exchange.d.ts +2 -1
  51. package/js/src/base/Exchange.js +26 -3
  52. package/js/src/base/functions/encode.d.ts +1 -1
  53. package/js/src/base/functions/encode.js +1 -1
  54. package/js/src/bigone.js +22 -14
  55. package/js/src/binance.js +8 -0
  56. package/js/src/bingx.d.ts +1 -1
  57. package/js/src/bingx.js +16 -40
  58. package/js/src/bitfinex.js +128 -88
  59. package/js/src/bitget.d.ts +1 -0
  60. package/js/src/bitget.js +60 -71
  61. package/js/src/bitmart.d.ts +1 -0
  62. package/js/src/bitmart.js +7 -2
  63. package/js/src/bitmex.js +12 -4
  64. package/js/src/bitopro.js +5 -1
  65. package/js/src/bitrue.js +2 -1
  66. package/js/src/bitso.js +1 -1
  67. package/js/src/bitteam.js +2 -0
  68. package/js/src/bitvavo.js +28 -10
  69. package/js/src/btcalpha.js +1 -1
  70. package/js/src/btcmarkets.js +1 -1
  71. package/js/src/btcturk.js +1 -1
  72. package/js/src/bybit.js +34 -16
  73. package/js/src/coinbase.d.ts +0 -2
  74. package/js/src/coinbase.js +4 -17
  75. package/js/src/coinex.js +1 -0
  76. package/js/src/coinlist.js +1 -0
  77. package/js/src/coinone.js +1 -0
  78. package/js/src/delta.js +4 -0
  79. package/js/src/deribit.js +1 -0
  80. package/js/src/hollaex.js +1 -0
  81. package/js/src/htx.js +9 -5
  82. package/js/src/huobijp.js +1 -0
  83. package/js/src/hyperliquid.js +16 -0
  84. package/js/src/kraken.js +2 -0
  85. package/js/src/okx.js +2 -3
  86. package/js/src/oxfun.d.ts +10 -0
  87. package/js/src/oxfun.js +21 -1
  88. package/js/src/poloniex.js +1 -0
  89. package/js/src/pro/binance.js +3 -3
  90. package/js/src/pro/coinbase.d.ts +4 -3
  91. package/js/src/pro/coinbase.js +43 -60
  92. package/js/src/pro/hyperliquid.js +10 -2
  93. package/js/src/pro/upbit.d.ts +16 -1
  94. package/js/src/pro/upbit.js +43 -0
  95. package/js/src/timex.js +2 -2
  96. package/js/src/upbit.d.ts +42 -20
  97. package/js/src/upbit.js +43 -21
  98. package/js/src/whitebit.js +65 -12
  99. package/package.json +1 -1
@@ -544,18 +544,69 @@ class whitebit extends whitebit$1 {
544
544
  async fetchCurrencies(params = {}) {
545
545
  const response = await this.v4PublicGetAssets(params);
546
546
  //
547
- // "BTC": {
548
- // "name": "Bitcoin",
549
- // "unified_cryptoasset_id": 1,
550
- // "can_withdraw": true,
551
- // "can_deposit": true,
552
- // "min_withdraw": "0.001",
553
- // "max_withdraw": "2",
554
- // "maker_fee": "0.1",
555
- // "taker_fee": "0.1",
556
- // "min_deposit": "0.0001",
557
- // "max_deposit": "0",
558
- // },
547
+ // {
548
+ // BTC: {
549
+ // name: "Bitcoin",
550
+ // unified_cryptoasset_id: "1",
551
+ // can_withdraw: true,
552
+ // can_deposit: true,
553
+ // min_withdraw: "0.0003",
554
+ // max_withdraw: "0",
555
+ // maker_fee: "0.1",
556
+ // taker_fee: "0.1",
557
+ // min_deposit: "0.0001",
558
+ // max_deposit: "0",
559
+ // networks: {
560
+ // deposits: [ "BTC", ],
561
+ // withdraws: [ "BTC", ],
562
+ // default: "BTC",
563
+ // },
564
+ // confirmations: {
565
+ // BTC: "2",
566
+ // },
567
+ // limits: {
568
+ // deposit: {
569
+ // BTC: { min: "0.0001", },
570
+ // },
571
+ // withdraw: {
572
+ // BTC: { min: "0.0003", },
573
+ // },
574
+ // },
575
+ // currency_precision: "8",
576
+ // is_memo: false,
577
+ // },
578
+ // USD: {
579
+ // name: "United States Dollar",
580
+ // unified_cryptoasset_id: "6955",
581
+ // can_withdraw: true,
582
+ // can_deposit: true,
583
+ // min_withdraw: "10",
584
+ // max_withdraw: "10000",
585
+ // maker_fee: "0.1",
586
+ // taker_fee: "0.1",
587
+ // min_deposit: "10",
588
+ // max_deposit: "10000",
589
+ // networks: {
590
+ // deposits: [ "USD", ],
591
+ // withdraws: [ "USD", ],
592
+ // default: "USD",
593
+ // },
594
+ // providers: {
595
+ // deposits: [ "ADVCASH", ],
596
+ // withdraws: [ "ADVCASH", ],
597
+ // },
598
+ // limits: {
599
+ // deposit: {
600
+ // USD: { max: "10000", min: "10", },
601
+ // },
602
+ // withdraw: {
603
+ // USD: { max: "10000", min: "10", },
604
+ // },
605
+ // },
606
+ // currency_precision: "2",
607
+ // is_memo: false,
608
+ // }
609
+ // }
559
610
  //
560
611
  const ids = Object.keys(response);
561
612
  const result = {};
@@ -568,6 +619,7 @@ class whitebit extends whitebit$1 {
568
619
  const canWithdraw = this.safeBool(currency, 'can_withdraw', true);
569
620
  const active = canDeposit && canWithdraw;
570
621
  const code = this.safeCurrencyCode(id);
622
+ const hasProvider = ('providers' in currency);
571
623
  result[code] = {
572
624
  'id': id,
573
625
  'code': code,
@@ -578,6 +630,7 @@ class whitebit extends whitebit$1 {
578
630
  'withdraw': canWithdraw,
579
631
  'fee': undefined,
580
632
  'networks': undefined,
633
+ 'type': hasProvider ? 'fiat' : 'crypto',
581
634
  'precision': undefined,
582
635
  'limits': {
583
636
  'amount': {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.77";
7
+ declare const version = "4.4.81";
8
8
  import alpaca from './src/alpaca.js';
9
9
  import apex from './src/apex.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.77';
41
+ const version = '4.4.81';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import alpaca from './src/alpaca.js';
@@ -60,6 +60,7 @@ interface Exchange {
60
60
  privateGetContractPrivateOrder(params?: {}): Promise<implicitReturnType>;
61
61
  privateGetContractPrivateOrderHistory(params?: {}): Promise<implicitReturnType>;
62
62
  privateGetContractPrivatePosition(params?: {}): Promise<implicitReturnType>;
63
+ privateGetContractPrivatePositionV2(params?: {}): Promise<implicitReturnType>;
63
64
  privateGetContractPrivateGetOpenOrders(params?: {}): Promise<implicitReturnType>;
64
65
  privateGetContractPrivateCurrentPlanOrder(params?: {}): Promise<implicitReturnType>;
65
66
  privateGetContractPrivateTrades(params?: {}): Promise<implicitReturnType>;
package/js/src/apex.js CHANGED
@@ -493,11 +493,6 @@ export default class apex extends Exchange {
493
493
  const code = this.safeCurrencyCode(currencyId);
494
494
  const name = this.safeString(currency, 'displayName');
495
495
  const networks = {};
496
- let minPrecision = undefined;
497
- let minWithdrawFeeString = undefined;
498
- let minWithdrawString = undefined;
499
- let deposit = false;
500
- let withdraw = false;
501
496
  for (let j = 0; j < chains.length; j++) {
502
497
  const chain = chains[j];
503
498
  const tokens = this.safeList(chain, 'tokens', []);
@@ -507,31 +502,22 @@ export default class apex extends Exchange {
507
502
  if (tokenName === currencyId) {
508
503
  const networkId = this.safeString(chain, 'chainId');
509
504
  const networkCode = this.networkIdToCode(networkId);
510
- const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
511
- minPrecision = (minPrecision === undefined) ? precision : Math.min(minPrecision, precision);
512
- const depositAllowed = !this.safeBool(chain, 'stopDeposit');
513
- deposit = (depositAllowed) ? depositAllowed : deposit;
514
- const withdrawAllowed = this.safeBool(token, 'withdrawEnable');
515
- withdraw = (withdrawAllowed) ? withdrawAllowed : withdraw;
516
- minWithdrawFeeString = this.safeString(token, 'minFee');
517
- minWithdrawString = this.safeString(token, 'minWithdraw');
518
- const minNetworkDepositString = this.safeString(chain, 'depositMin');
519
505
  networks[networkCode] = {
520
506
  'info': chain,
521
507
  'id': networkId,
522
508
  'network': networkCode,
523
- 'active': depositAllowed && withdrawAllowed,
524
- 'deposit': depositAllowed,
525
- 'withdraw': withdrawAllowed,
526
- 'fee': this.parseNumber(minWithdrawFeeString),
527
- 'precision': precision,
509
+ 'active': undefined,
510
+ 'deposit': !this.safeBool(chain, 'depositDisable'),
511
+ 'withdraw': this.safeBool(token, 'withdrawEnable'),
512
+ 'fee': this.safeNumber(token, 'minFee'),
513
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(token, 'decimals'))),
528
514
  'limits': {
529
515
  'withdraw': {
530
- 'min': this.parseNumber(minWithdrawString),
516
+ 'min': this.safeNumber(token, 'minWithdraw'),
531
517
  'max': undefined,
532
518
  },
533
519
  'deposit': {
534
- 'min': this.parseNumber(minNetworkDepositString),
520
+ 'min': this.safeNumber(chain, 'minDeposit'),
535
521
  'max': undefined,
536
522
  },
537
523
  },
@@ -539,24 +525,28 @@ export default class apex extends Exchange {
539
525
  }
540
526
  }
541
527
  }
542
- result[code] = {
528
+ const networkKeys = Object.keys(networks);
529
+ const networksLength = networkKeys.length;
530
+ const emptyChains = networksLength === 0; // non-functional coins
531
+ const valueForEmpty = emptyChains ? false : undefined;
532
+ result[code] = this.safeCurrencyStructure({
543
533
  'info': currency,
544
534
  'code': code,
545
535
  'id': currencyId,
546
536
  'type': 'crypto',
547
537
  'name': name,
548
- 'active': deposit && withdraw,
549
- 'deposit': deposit,
550
- 'withdraw': withdraw,
551
- 'fee': this.parseNumber(minWithdrawFeeString),
552
- 'precision': minPrecision,
538
+ 'active': undefined,
539
+ 'deposit': valueForEmpty,
540
+ 'withdraw': valueForEmpty,
541
+ 'fee': undefined,
542
+ 'precision': undefined,
553
543
  'limits': {
554
544
  'amount': {
555
545
  'min': undefined,
556
546
  'max': undefined,
557
547
  },
558
548
  'withdraw': {
559
- 'min': this.parseNumber(minWithdrawString),
549
+ 'min': undefined,
560
550
  'max': undefined,
561
551
  },
562
552
  'deposit': {
@@ -565,7 +555,7 @@ export default class apex extends Exchange {
565
555
  },
566
556
  },
567
557
  'networks': networks,
568
- };
558
+ });
569
559
  }
570
560
  return result;
571
561
  }
@@ -828,7 +818,7 @@ export default class apex extends Exchange {
828
818
  }
829
819
  parseOHLCV(ohlcv, market = undefined) {
830
820
  //
831
- // {
821
+ // {
832
822
  // "start": 1647511440000,
833
823
  // "symbol": "BTC-USD",
834
824
  // "interval": "1",
@@ -838,7 +828,7 @@ export default class apex extends Exchange {
838
828
  // "close": "40000",
839
829
  // "volume": "1.002",
840
830
  // "turnover": "3"
841
- // } {"s":"BTCUSDT","i":"1","t":1741265880000,"c":"90235","h":"90235","l":"90156","o":"90156","v":"0.052","tr":"4690.4466"}
831
+ // } {"s":"BTCUSDT","i":"1","t":1741265880000,"c":"90235","h":"90235","l":"90156","o":"90156","v":"0.052","tr":"4690.4466"}
842
832
  //
843
833
  return [
844
834
  this.safeIntegerN(ohlcv, ['start', 't']),
@@ -515,6 +515,7 @@ export default class ascendex extends Exchange {
515
515
  // "data":[
516
516
  // {
517
517
  // "assetCode":"BTT",
518
+ // "displayName": "BTT",
518
519
  // "borrowAssetCode":"BTT-B",
519
520
  // "interestAssetCode":"BTT-I",
520
521
  // "nativeScale":0,
@@ -535,12 +536,13 @@ export default class ascendex extends Exchange {
535
536
  // "data":[
536
537
  // {
537
538
  // "assetCode":"LTCBULL",
539
+ // "displayName": "LTCBULL",
538
540
  // "nativeScale":4,
539
541
  // "numConfirmations":20,
540
542
  // "withdrawFee":"0.2",
541
543
  // "minWithdrawalAmt":"1.0",
542
544
  // "statusCode":"Normal",
543
- // "statusMessage":""
545
+ // "statusMessage":"" // hideFromWalletTx
544
546
  // }
545
547
  // ]
546
548
  // }
@@ -562,8 +564,27 @@ export default class ascendex extends Exchange {
562
564
  const scale = this.safeString2(currency, 'precisionScale', 'nativeScale');
563
565
  const precision = this.parseNumber(this.parsePrecision(scale));
564
566
  const fee = this.safeNumber2(currency, 'withdrawFee', 'withdrawalFee');
565
- const status = this.safeString2(currency, 'status', 'statusCode');
567
+ const status = this.safeString(currency, 'status');
568
+ const statusCode = this.safeString(currency, 'statusCode');
566
569
  const active = (status === 'Normal');
570
+ let depositEnabled = undefined;
571
+ let withdrawEnabled = undefined;
572
+ if (status === 'Delisted' || statusCode === 'hideFromWalletTx') {
573
+ depositEnabled = false;
574
+ withdrawEnabled = false;
575
+ }
576
+ else if (status === 'Normal') {
577
+ depositEnabled = true;
578
+ withdrawEnabled = true;
579
+ }
580
+ else if (status === 'NoTransaction' || statusCode === 'NoTransaction') {
581
+ depositEnabled = true;
582
+ withdrawEnabled = false;
583
+ }
584
+ else if (status === 'NoDeposit') {
585
+ depositEnabled = false;
586
+ withdrawEnabled = true;
587
+ }
567
588
  const marginInside = ('borrowAssetCode' in currency);
568
589
  result[code] = {
569
590
  'id': id,
@@ -573,8 +594,8 @@ export default class ascendex extends Exchange {
573
594
  'margin': marginInside,
574
595
  'name': this.safeString(currency, 'assetName'),
575
596
  'active': active,
576
- 'deposit': undefined,
577
- 'withdraw': undefined,
597
+ 'deposit': depositEnabled,
598
+ 'withdraw': withdrawEnabled,
578
599
  'fee': fee,
579
600
  'precision': precision,
580
601
  'limits': {
@@ -587,7 +608,7 @@ export default class ascendex extends Exchange {
587
608
  'max': undefined,
588
609
  },
589
610
  },
590
- 'networks': {},
611
+ 'networks': {}, // todo
591
612
  };
592
613
  }
593
614
  return result;
@@ -252,7 +252,7 @@ export default class Exchange {
252
252
  }, digest?: "binary" | "hex" | "base64") => any;
253
253
  arrayConcat: (a: any[], b: any[]) => any[];
254
254
  encode: (str: string) => Uint8Array;
255
- urlencode: (object: object) => string;
255
+ urlencode: (object: object, sort?: boolean) => string;
256
256
  hmac: (request: import("../static_dependencies/noble-hashes/utils.js").Input, secret: import("../static_dependencies/noble-hashes/utils.js").Input, hash: {
257
257
  (message: import("../static_dependencies/noble-hashes/utils.js").Input): Uint8Array;
258
258
  outputLen: number;
@@ -764,6 +764,7 @@ export default class Exchange {
764
764
  currency(code: string): any;
765
765
  market(symbol: string): MarketInterface;
766
766
  createExpiredOptionMarket(symbol: string): MarketInterface;
767
+ isLeveragedCurrency(currencyCode: any, checkBaseCoin?: Bool, existingCurrencies?: Dict): boolean;
767
768
  handleWithdrawTagAndParams(tag: any, params: any): any;
768
769
  createLimitOrder(symbol: string, side: OrderSide, amount: number, price: number, params?: {}): Promise<Order>;
769
770
  createLimitOrderWs(symbol: string, side: OrderSide, amount: number, price: number, params?: {}): Promise<Order>;
@@ -482,7 +482,7 @@ export default class Exchange {
482
482
  }
483
483
  if (httpProxy) {
484
484
  if (this.httpProxyAgentModule === undefined) {
485
- throw new NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
485
+ throw new NotSupported(this.id + ' you need to load JS proxy modules with `await instance.loadProxyModules()` method at first to use proxies');
486
486
  }
487
487
  if (!(httpProxy in this.proxyDictionaries)) {
488
488
  this.proxyDictionaries[httpProxy] = new this.httpProxyAgentModule.HttpProxyAgent(httpProxy);
@@ -491,7 +491,7 @@ export default class Exchange {
491
491
  }
492
492
  else if (httpsProxy) {
493
493
  if (this.httpsProxyAgentModule === undefined) {
494
- throw new NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
494
+ throw new NotSupported(this.id + ' you need to load JS proxy modules with `await instance.loadProxyModules()` method at first to use proxies');
495
495
  }
496
496
  if (!(httpsProxy in this.proxyDictionaries)) {
497
497
  this.proxyDictionaries[httpsProxy] = new this.httpsProxyAgentModule.HttpsProxyAgent(httpsProxy);
@@ -501,7 +501,7 @@ export default class Exchange {
501
501
  }
502
502
  else if (socksProxy) {
503
503
  if (this.socksProxyAgentModule === undefined) {
504
- throw new NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" and then initialize proxies with `.loadProxyModules()` method');
504
+ throw new NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" and then initialize proxies with `await instance.loadProxyModules()` method');
505
505
  }
506
506
  if (!(socksProxy in this.proxyDictionaries)) {
507
507
  this.proxyDictionaries[socksProxy] = new this.socksProxyAgentModule.SocksProxyAgent(socksProxy);
@@ -5553,6 +5553,29 @@ export default class Exchange {
5553
5553
  createExpiredOptionMarket(symbol) {
5554
5554
  throw new NotSupported(this.id + ' createExpiredOptionMarket () is not supported yet');
5555
5555
  }
5556
+ isLeveragedCurrency(currencyCode, checkBaseCoin = false, existingCurrencies = undefined) {
5557
+ const leverageSuffixes = [
5558
+ '2L', '2S', '3L', '3S', '4L', '4S', '5L', '5S',
5559
+ 'UP', 'DOWN',
5560
+ 'BULL', 'BEAR', // similar
5561
+ ];
5562
+ for (let i = 0; i < leverageSuffixes.length; i++) {
5563
+ const leverageSuffix = leverageSuffixes[i];
5564
+ if (currencyCode.endsWith(leverageSuffix)) {
5565
+ if (!checkBaseCoin) {
5566
+ return true;
5567
+ }
5568
+ else {
5569
+ // check if base currency is inside dict
5570
+ const baseCurrencyCode = currencyCode.replace(leverageSuffix, '');
5571
+ if (baseCurrencyCode in existingCurrencies) {
5572
+ return true;
5573
+ }
5574
+ }
5575
+ }
5576
+ }
5577
+ return false;
5578
+ }
5556
5579
  handleWithdrawTagAndParams(tag, params) {
5557
5580
  if ((tag !== undefined) && (typeof tag === 'object')) {
5558
5581
  params = this.extend(tag, params);
@@ -1,4 +1,4 @@
1
1
  import { concatBytes } from '../../static_dependencies/noble-curves/abstract/utils.js';
2
- declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string: string) => string, base64ToString: (string: string) => string, base64ToBinary: (str: string) => Uint8Array, binaryToBase64: (data: Uint8Array) => string, base16ToBinary: (str: string) => Uint8Array, binaryToBase16: (data: Uint8Array) => string, base58ToBinary: (str: string) => Uint8Array, binaryToBase58: (data: Uint8Array) => string, binaryConcat: typeof concatBytes, binaryConcatArray: (arr: any[]) => Uint8Array, urlencode: (object: object) => string, urlencodeNested: (object: object) => string, urlencodeWithArrayRepeat: (object: object) => string, rawencode: (object: object) => string, encode: (str: string) => Uint8Array, decode: (data: Uint8Array) => string, urlencodeBase64: (payload: string | Uint8Array) => string, numberToLE: (n: number, padding: number) => Uint8Array, numberToBE: (n: number, padding: number) => Uint8Array;
2
+ declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string: string) => string, base64ToString: (string: string) => string, base64ToBinary: (str: string) => Uint8Array, binaryToBase64: (data: Uint8Array) => string, base16ToBinary: (str: string) => Uint8Array, binaryToBase16: (data: Uint8Array) => string, base58ToBinary: (str: string) => Uint8Array, binaryToBase58: (data: Uint8Array) => string, binaryConcat: typeof concatBytes, binaryConcatArray: (arr: any[]) => Uint8Array, urlencode: (object: object, sort?: boolean) => string, urlencodeNested: (object: object) => string, urlencodeWithArrayRepeat: (object: object) => string, rawencode: (object: object) => string, encode: (str: string) => Uint8Array, decode: (data: Uint8Array) => string, urlencodeBase64: (payload: string | Uint8Array) => string, numberToLE: (n: number, padding: number) => Uint8Array, numberToBE: (n: number, padding: number) => Uint8Array;
3
3
  declare function packb(req: any): Uint8Array;
4
4
  export { json, isJsonEncodedObject, binaryToString, stringToBinary, stringToBase64, base64ToBinary, base64ToString, binaryToBase64, base16ToBinary, binaryToBase16, binaryConcat, binaryConcatArray, urlencode, urlencodeWithArrayRepeat, rawencode, encode, decode, urlencodeBase64, numberToLE, numberToBE, base58ToBinary, binaryToBase58, urlencodeNested, packb };
@@ -13,7 +13,7 @@ import qs from '../../static_dependencies/qs/index.cjs';
13
13
  /* ------------------------------------------------------------------------ */
14
14
  const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = (object) => ((typeof object === 'string') &&
15
15
  (object.length >= 2) &&
16
- ((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = (string) => base64.encode(utf8.decode(string)), base64ToString = (string) => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = (object) => qs.stringify(object), urlencodeNested = (object) => qs.stringify(object) // implemented only in python
16
+ ((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = (string) => base64.encode(utf8.decode(string)), base64ToString = (string) => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = (object, sort = false) => qs.stringify(object), urlencodeNested = (object) => qs.stringify(object) // implemented only in python
17
17
  , urlencodeWithArrayRepeat = (object) => qs.stringify(object, { arrayFormat: 'repeat' }), rawencode = (object) => qs.stringify(object, { encode: false }), encode = utf8.decode // lol
18
18
  , decode = utf8.encode
19
19
  // Url-safe-base64 without equals signs, with + replaced by - and slashes replaced by underscores
package/js/src/bigone.js CHANGED
@@ -505,19 +505,15 @@ export default class bigone extends Exchange {
505
505
  const id = this.safeString(currency, 'symbol');
506
506
  const code = this.safeCurrencyCode(id);
507
507
  const name = this.safeString(currency, 'name');
508
- const type = this.safeBool(currency, 'is_fiat') ? 'fiat' : 'crypto';
509
508
  const networks = {};
510
509
  const chains = this.safeList(currency, 'binding_gateways', []);
511
- let currencyMaxPrecision = this.parsePrecision(this.safeString2(currency, 'withdrawal_scale', 'scale'));
512
- let currencyDepositEnabled = undefined;
513
- let currencyWithdrawEnabled = undefined;
510
+ const currencyMaxPrecision = this.parsePrecision(this.safeString2(currency, 'withdrawal_scale', 'scale'));
514
511
  for (let j = 0; j < chains.length; j++) {
515
512
  const chain = chains[j];
516
513
  const networkId = this.safeString(chain, 'gateway_name');
517
514
  const networkCode = this.networkIdToCode(networkId);
518
515
  const deposit = this.safeBool(chain, 'is_deposit_enabled');
519
516
  const withdraw = this.safeBool(chain, 'is_withdrawal_enabled');
520
- const isActive = (deposit && withdraw);
521
517
  const minDepositAmount = this.safeString(chain, 'min_deposit_amount');
522
518
  const minWithdrawalAmount = this.safeString(chain, 'min_withdrawal_amount');
523
519
  const withdrawalFee = this.safeString(chain, 'withdrawal_fee');
@@ -528,7 +524,7 @@ export default class bigone extends Exchange {
528
524
  'margin': undefined,
529
525
  'deposit': deposit,
530
526
  'withdraw': withdraw,
531
- 'active': isActive,
527
+ 'active': undefined,
532
528
  'fee': this.parseNumber(withdrawalFee),
533
529
  'precision': this.parseNumber(precision),
534
530
  'limits': {
@@ -543,20 +539,32 @@ export default class bigone extends Exchange {
543
539
  },
544
540
  'info': chain,
545
541
  };
546
- // fill global values
547
- currencyDepositEnabled = (currencyDepositEnabled === undefined) || deposit ? deposit : currencyDepositEnabled;
548
- currencyWithdrawEnabled = (currencyWithdrawEnabled === undefined) || withdraw ? withdraw : currencyWithdrawEnabled;
549
- currencyMaxPrecision = (currencyMaxPrecision === undefined) || Precise.stringGt(currencyMaxPrecision, precision) ? precision : currencyMaxPrecision;
550
542
  }
551
- result[code] = {
543
+ const chainLength = chains.length;
544
+ let type = undefined;
545
+ if (this.safeBool(currency, 'is_fiat')) {
546
+ type = 'fiat';
547
+ }
548
+ else if (chainLength === 0) {
549
+ if (this.isLeveragedCurrency(id)) {
550
+ type = 'leveraged';
551
+ }
552
+ else {
553
+ type = 'other';
554
+ }
555
+ }
556
+ else {
557
+ type = 'crypto';
558
+ }
559
+ result[code] = this.safeCurrencyStructure({
552
560
  'id': id,
553
561
  'code': code,
554
562
  'info': currency,
555
563
  'name': name,
556
564
  'type': type,
557
565
  'active': undefined,
558
- 'deposit': currencyDepositEnabled,
559
- 'withdraw': currencyWithdrawEnabled,
566
+ 'deposit': undefined,
567
+ 'withdraw': undefined,
560
568
  'fee': undefined,
561
569
  'precision': this.parseNumber(currencyMaxPrecision),
562
570
  'limits': {
@@ -570,7 +578,7 @@ export default class bigone extends Exchange {
570
578
  },
571
579
  },
572
580
  'networks': networks,
573
- };
581
+ });
574
582
  }
575
583
  return result;
576
584
  }
package/js/src/binance.js CHANGED
@@ -1273,6 +1273,7 @@ export default class binance extends Exchange {
1273
1273
  'inverse', // allows CORS in browsers
1274
1274
  // 'option', // does not allow CORS, enable outside of the browser only
1275
1275
  ],
1276
+ 'loadAllOptions': false,
1276
1277
  'fetchCurrencies': true,
1277
1278
  // 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades, eapiPublicGetTrades
1278
1279
  // 'repayCrossMarginMethod': 'papiPostRepayLoan', // papiPostMarginRepayDebt
@@ -3039,6 +3040,13 @@ export default class binance extends Exchange {
3039
3040
  async fetchMarkets(params = {}) {
3040
3041
  const promisesRaw = [];
3041
3042
  const rawFetchMarkets = this.safeList(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
3043
+ // handle loadAllOptions option
3044
+ const loadAllOptions = this.safeBool(this.options, 'loadAllOptions', false);
3045
+ if (loadAllOptions) {
3046
+ if (!this.inArray('option', rawFetchMarkets)) {
3047
+ rawFetchMarkets.push('option');
3048
+ }
3049
+ }
3042
3050
  const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
3043
3051
  const fetchMarkets = [];
3044
3052
  for (let i = 0; i < rawFetchMarkets.length; i++) {
package/js/src/bingx.d.ts CHANGED
@@ -635,7 +635,7 @@ export default class bingx extends Exchange {
635
635
  * @param {string} address the address to withdraw to
636
636
  * @param {string} [tag]
637
637
  * @param {object} [params] extra parameters specific to the exchange API endpoint
638
- * @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account
638
+ * @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account, 15 spot account
639
639
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
640
640
  */
641
641
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
package/js/src/bingx.js CHANGED
@@ -712,7 +712,7 @@ export default class bingx extends Exchange {
712
712
  //
713
713
  // {
714
714
  // "code": 0,
715
- // "timestamp": 1702623271477,
715
+ // "timestamp": 1702623271476,
716
716
  // "data": [
717
717
  // {
718
718
  // "coin": "BTC",
@@ -756,61 +756,43 @@ export default class bingx extends Exchange {
756
756
  const name = this.safeString(entry, 'name');
757
757
  const networkList = this.safeList(entry, 'networkList');
758
758
  const networks = {};
759
- let fee = undefined;
760
- let depositEnabled = false;
761
- let withdrawEnabled = false;
762
- let defaultLimits = {};
763
759
  for (let j = 0; j < networkList.length; j++) {
764
760
  const rawNetwork = networkList[j];
765
761
  const network = this.safeString(rawNetwork, 'network');
766
762
  const networkCode = this.networkIdToCode(network);
767
- const isDefault = this.safeBool(rawNetwork, 'isDefault');
768
- const networkDepositEnabled = this.safeBool(rawNetwork, 'depositEnable');
769
- if (networkDepositEnabled) {
770
- depositEnabled = true;
771
- }
772
- const networkWithdrawEnabled = this.safeBool(rawNetwork, 'withdrawEnable');
773
- if (networkWithdrawEnabled) {
774
- withdrawEnabled = true;
775
- }
776
763
  const limits = {
777
764
  'withdraw': {
778
765
  'min': this.safeNumber(rawNetwork, 'withdrawMin'),
779
766
  'max': this.safeNumber(rawNetwork, 'withdrawMax'),
780
767
  },
781
768
  };
782
- fee = this.safeNumber(rawNetwork, 'withdrawFee');
783
- if (isDefault) {
784
- defaultLimits = limits;
785
- }
786
- const precision = this.safeNumber(rawNetwork, 'withdrawPrecision');
787
- const networkActive = networkDepositEnabled || networkWithdrawEnabled;
769
+ const precision = this.parseNumber(this.parsePrecision(this.safeString(rawNetwork, 'withdrawPrecision')));
788
770
  networks[networkCode] = {
789
771
  'info': rawNetwork,
790
772
  'id': network,
791
773
  'network': networkCode,
792
- 'fee': fee,
793
- 'active': networkActive,
794
- 'deposit': networkDepositEnabled,
795
- 'withdraw': networkWithdrawEnabled,
774
+ 'fee': this.safeNumber(rawNetwork, 'withdrawFee'),
775
+ 'active': undefined,
776
+ 'deposit': this.safeBool(rawNetwork, 'depositEnable'),
777
+ 'withdraw': this.safeBool(rawNetwork, 'withdrawEnable'),
796
778
  'precision': precision,
797
779
  'limits': limits,
798
780
  };
799
781
  }
800
- const active = depositEnabled || withdrawEnabled;
801
- result[code] = {
782
+ result[code] = this.safeCurrencyStructure({
802
783
  'info': entry,
803
784
  'code': code,
804
785
  'id': currencyId,
805
786
  'precision': undefined,
806
787
  'name': name,
807
- 'active': active,
808
- 'deposit': depositEnabled,
809
- 'withdraw': withdrawEnabled,
788
+ 'active': undefined,
789
+ 'deposit': undefined,
790
+ 'withdraw': undefined,
810
791
  'networks': networks,
811
- 'fee': fee,
812
- 'limits': defaultLimits,
813
- };
792
+ 'fee': undefined,
793
+ 'limits': undefined,
794
+ 'type': 'crypto', // only cryptos now
795
+ });
814
796
  }
815
797
  return result;
816
798
  }
@@ -5800,7 +5782,7 @@ export default class bingx extends Exchange {
5800
5782
  * @param {string} address the address to withdraw to
5801
5783
  * @param {string} [tag]
5802
5784
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5803
- * @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account
5785
+ * @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account, 15 spot account
5804
5786
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
5805
5787
  */
5806
5788
  async withdraw(code, amount, address, tag = undefined, params = {}) {
@@ -5808,13 +5790,7 @@ export default class bingx extends Exchange {
5808
5790
  this.checkAddress(address);
5809
5791
  await this.loadMarkets();
5810
5792
  const currency = this.currency(code);
5811
- let walletType = this.safeInteger(params, 'walletType');
5812
- if (walletType === undefined) {
5813
- walletType = 1;
5814
- }
5815
- if (!this.inArray(walletType, [1, 2, 3])) {
5816
- throw new BadRequest(this.id + ' withdraw() requires either 1 fund account, 2 standard futures account, 3 perpetual account for walletType');
5817
- }
5793
+ const walletType = this.safeInteger(params, 'walletType', 1);
5818
5794
  const request = {
5819
5795
  'coin': currency['id'],
5820
5796
  'address': address,