ccxt 4.4.80__py2.py3-none-any.whl → 4.4.82__py2.py3-none-any.whl

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.
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.4.80'
25
+ __version__ = '4.4.82'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/apex.py CHANGED
@@ -498,11 +498,6 @@ class apex(Exchange, ImplicitAPI):
498
498
  code = self.safe_currency_code(currencyId)
499
499
  name = self.safe_string(currency, 'displayName')
500
500
  networks: dict = {}
501
- minPrecision = None
502
- minWithdrawFeeString = None
503
- minWithdrawString = None
504
- deposit = False
505
- withdraw = False
506
501
  for j in range(0, len(chains)):
507
502
  chain = chains[j]
508
503
  tokens = self.safe_list(chain, 'tokens', [])
@@ -512,53 +507,48 @@ class apex(Exchange, ImplicitAPI):
512
507
  if tokenName == currencyId:
513
508
  networkId = self.safe_string(chain, 'chainId')
514
509
  networkCode = self.network_id_to_code(networkId)
515
- precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
516
- minPrecision = precision if (minPrecision is None) else min(minPrecision, precision)
517
- depositAllowed = not self.safe_bool(chain, 'stopDeposit')
518
- deposit = depositAllowed if (depositAllowed) else deposit
519
- withdrawAllowed = self.safe_bool(token, 'withdrawEnable')
520
- withdraw = withdrawAllowed if (withdrawAllowed) else withdraw
521
- minWithdrawFeeString = self.safe_string(token, 'minFee')
522
- minWithdrawString = self.safe_string(token, 'minWithdraw')
523
- minNetworkDepositString = self.safe_string(chain, 'depositMin')
524
510
  networks[networkCode] = {
525
511
  'info': chain,
526
512
  'id': networkId,
527
513
  'network': networkCode,
528
- 'active': depositAllowed and withdrawAllowed,
529
- 'deposit': depositAllowed,
530
- 'withdraw': withdrawAllowed,
531
- 'fee': self.parse_number(minWithdrawFeeString),
532
- 'precision': precision,
514
+ 'active': None,
515
+ 'deposit': not self.safe_bool(chain, 'depositDisable'),
516
+ 'withdraw': self.safe_bool(token, 'withdrawEnable'),
517
+ 'fee': self.safe_number(token, 'minFee'),
518
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(token, 'decimals'))),
533
519
  'limits': {
534
520
  'withdraw': {
535
- 'min': self.parse_number(minWithdrawString),
521
+ 'min': self.safe_number(token, 'minWithdraw'),
536
522
  'max': None,
537
523
  },
538
524
  'deposit': {
539
- 'min': self.parse_number(minNetworkDepositString),
525
+ 'min': self.safe_number(chain, 'minDeposit'),
540
526
  'max': None,
541
527
  },
542
528
  },
543
529
  }
544
- result[code] = {
530
+ networkKeys = list(networks.keys())
531
+ networksLength = len(networkKeys)
532
+ emptyChains = networksLength == 0 # non-functional coins
533
+ valueForEmpty = False if emptyChains else None
534
+ result[code] = self.safe_currency_structure({
545
535
  'info': currency,
546
536
  'code': code,
547
537
  'id': currencyId,
548
538
  'type': 'crypto',
549
539
  'name': name,
550
- 'active': deposit and withdraw,
551
- 'deposit': deposit,
552
- 'withdraw': withdraw,
553
- 'fee': self.parse_number(minWithdrawFeeString),
554
- 'precision': minPrecision,
540
+ 'active': None,
541
+ 'deposit': valueForEmpty,
542
+ 'withdraw': valueForEmpty,
543
+ 'fee': None,
544
+ 'precision': None,
555
545
  'limits': {
556
546
  'amount': {
557
547
  'min': None,
558
548
  'max': None,
559
549
  },
560
550
  'withdraw': {
561
- 'min': self.parse_number(minWithdrawString),
551
+ 'min': None,
562
552
  'max': None,
563
553
  },
564
554
  'deposit': {
@@ -567,7 +557,7 @@ class apex(Exchange, ImplicitAPI):
567
557
  },
568
558
  },
569
559
  'networks': networks,
570
- }
560
+ })
571
561
  return result
572
562
 
573
563
  def fetch_markets(self, params={}) -> List[Market]:
ccxt/ascendex.py CHANGED
@@ -610,7 +610,7 @@ class ascendex(Exchange, ImplicitAPI):
610
610
  'max': None,
611
611
  },
612
612
  },
613
- 'networks': {},
613
+ 'networks': {}, # todo
614
614
  }
615
615
  return result
616
616
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.80'
7
+ __version__ = '4.4.82'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -498,11 +498,6 @@ class apex(Exchange, ImplicitAPI):
498
498
  code = self.safe_currency_code(currencyId)
499
499
  name = self.safe_string(currency, 'displayName')
500
500
  networks: dict = {}
501
- minPrecision = None
502
- minWithdrawFeeString = None
503
- minWithdrawString = None
504
- deposit = False
505
- withdraw = False
506
501
  for j in range(0, len(chains)):
507
502
  chain = chains[j]
508
503
  tokens = self.safe_list(chain, 'tokens', [])
@@ -512,53 +507,48 @@ class apex(Exchange, ImplicitAPI):
512
507
  if tokenName == currencyId:
513
508
  networkId = self.safe_string(chain, 'chainId')
514
509
  networkCode = self.network_id_to_code(networkId)
515
- precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
516
- minPrecision = precision if (minPrecision is None) else min(minPrecision, precision)
517
- depositAllowed = not self.safe_bool(chain, 'stopDeposit')
518
- deposit = depositAllowed if (depositAllowed) else deposit
519
- withdrawAllowed = self.safe_bool(token, 'withdrawEnable')
520
- withdraw = withdrawAllowed if (withdrawAllowed) else withdraw
521
- minWithdrawFeeString = self.safe_string(token, 'minFee')
522
- minWithdrawString = self.safe_string(token, 'minWithdraw')
523
- minNetworkDepositString = self.safe_string(chain, 'depositMin')
524
510
  networks[networkCode] = {
525
511
  'info': chain,
526
512
  'id': networkId,
527
513
  'network': networkCode,
528
- 'active': depositAllowed and withdrawAllowed,
529
- 'deposit': depositAllowed,
530
- 'withdraw': withdrawAllowed,
531
- 'fee': self.parse_number(minWithdrawFeeString),
532
- 'precision': precision,
514
+ 'active': None,
515
+ 'deposit': not self.safe_bool(chain, 'depositDisable'),
516
+ 'withdraw': self.safe_bool(token, 'withdrawEnable'),
517
+ 'fee': self.safe_number(token, 'minFee'),
518
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(token, 'decimals'))),
533
519
  'limits': {
534
520
  'withdraw': {
535
- 'min': self.parse_number(minWithdrawString),
521
+ 'min': self.safe_number(token, 'minWithdraw'),
536
522
  'max': None,
537
523
  },
538
524
  'deposit': {
539
- 'min': self.parse_number(minNetworkDepositString),
525
+ 'min': self.safe_number(chain, 'minDeposit'),
540
526
  'max': None,
541
527
  },
542
528
  },
543
529
  }
544
- result[code] = {
530
+ networkKeys = list(networks.keys())
531
+ networksLength = len(networkKeys)
532
+ emptyChains = networksLength == 0 # non-functional coins
533
+ valueForEmpty = False if emptyChains else None
534
+ result[code] = self.safe_currency_structure({
545
535
  'info': currency,
546
536
  'code': code,
547
537
  'id': currencyId,
548
538
  'type': 'crypto',
549
539
  'name': name,
550
- 'active': deposit and withdraw,
551
- 'deposit': deposit,
552
- 'withdraw': withdraw,
553
- 'fee': self.parse_number(minWithdrawFeeString),
554
- 'precision': minPrecision,
540
+ 'active': None,
541
+ 'deposit': valueForEmpty,
542
+ 'withdraw': valueForEmpty,
543
+ 'fee': None,
544
+ 'precision': None,
555
545
  'limits': {
556
546
  'amount': {
557
547
  'min': None,
558
548
  'max': None,
559
549
  },
560
550
  'withdraw': {
561
- 'min': self.parse_number(minWithdrawString),
551
+ 'min': None,
562
552
  'max': None,
563
553
  },
564
554
  'deposit': {
@@ -567,7 +557,7 @@ class apex(Exchange, ImplicitAPI):
567
557
  },
568
558
  },
569
559
  'networks': networks,
570
- }
560
+ })
571
561
  return result
572
562
 
573
563
  async def fetch_markets(self, params={}) -> List[Market]:
@@ -611,7 +611,7 @@ class ascendex(Exchange, ImplicitAPI):
611
611
  'max': None,
612
612
  },
613
613
  },
614
- 'networks': {},
614
+ 'networks': {}, # todo
615
615
  }
616
616
  return result
617
617
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.80'
5
+ __version__ = '4.4.82'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bigone import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -510,19 +510,15 @@ class bigone(Exchange, ImplicitAPI):
510
510
  id = self.safe_string(currency, 'symbol')
511
511
  code = self.safe_currency_code(id)
512
512
  name = self.safe_string(currency, 'name')
513
- type = 'fiat' if self.safe_bool(currency, 'is_fiat') else 'crypto'
514
513
  networks: dict = {}
515
514
  chains = self.safe_list(currency, 'binding_gateways', [])
516
515
  currencyMaxPrecision = self.parse_precision(self.safe_string_2(currency, 'withdrawal_scale', 'scale'))
517
- currencyDepositEnabled: Bool = None
518
- currencyWithdrawEnabled: Bool = None
519
516
  for j in range(0, len(chains)):
520
517
  chain = chains[j]
521
518
  networkId = self.safe_string(chain, 'gateway_name')
522
519
  networkCode = self.network_id_to_code(networkId)
523
520
  deposit = self.safe_bool(chain, 'is_deposit_enabled')
524
521
  withdraw = self.safe_bool(chain, 'is_withdrawal_enabled')
525
- isActive = (deposit and withdraw)
526
522
  minDepositAmount = self.safe_string(chain, 'min_deposit_amount')
527
523
  minWithdrawalAmount = self.safe_string(chain, 'min_withdrawal_amount')
528
524
  withdrawalFee = self.safe_string(chain, 'withdrawal_fee')
@@ -533,7 +529,7 @@ class bigone(Exchange, ImplicitAPI):
533
529
  'margin': None,
534
530
  'deposit': deposit,
535
531
  'withdraw': withdraw,
536
- 'active': isActive,
532
+ 'active': None,
537
533
  'fee': self.parse_number(withdrawalFee),
538
534
  'precision': self.parse_number(precision),
539
535
  'limits': {
@@ -548,19 +544,26 @@ class bigone(Exchange, ImplicitAPI):
548
544
  },
549
545
  'info': chain,
550
546
  }
551
- # fill global values
552
- currencyDepositEnabled = (currencyDepositEnabled is None) or deposit if deposit else currencyDepositEnabled
553
- currencyWithdrawEnabled = (currencyWithdrawEnabled is None) or withdraw if withdraw else currencyWithdrawEnabled
554
- currencyMaxPrecision = (currencyMaxPrecision is None) or precision if Precise.string_gt(currencyMaxPrecision, precision) else currencyMaxPrecision
555
- result[code] = {
547
+ chainLength = len(chains)
548
+ type: Str = None
549
+ if self.safe_bool(currency, 'is_fiat'):
550
+ type = 'fiat'
551
+ elif chainLength == 0:
552
+ if self.is_leveraged_currency(id):
553
+ type = 'leveraged'
554
+ else:
555
+ type = 'other'
556
+ else:
557
+ type = 'crypto'
558
+ result[code] = self.safe_currency_structure({
556
559
  'id': id,
557
560
  'code': code,
558
561
  'info': currency,
559
562
  'name': name,
560
563
  'type': type,
561
564
  'active': None,
562
- 'deposit': currencyDepositEnabled,
563
- 'withdraw': currencyWithdrawEnabled,
565
+ 'deposit': None,
566
+ 'withdraw': None,
564
567
  'fee': None,
565
568
  'precision': self.parse_number(currencyMaxPrecision),
566
569
  'limits': {
@@ -574,7 +577,7 @@ class bigone(Exchange, ImplicitAPI):
574
577
  },
575
578
  },
576
579
  'networks': networks,
577
- }
580
+ })
578
581
  return result
579
582
 
580
583
  async def fetch_markets(self, params={}) -> List[Market]:
@@ -767,56 +767,41 @@ class bingx(Exchange, ImplicitAPI):
767
767
  name = self.safe_string(entry, 'name')
768
768
  networkList = self.safe_list(entry, 'networkList')
769
769
  networks: dict = {}
770
- fee = None
771
- depositEnabled = False
772
- withdrawEnabled = False
773
- defaultLimits: dict = {}
774
770
  for j in range(0, len(networkList)):
775
771
  rawNetwork = networkList[j]
776
772
  network = self.safe_string(rawNetwork, 'network')
777
773
  networkCode = self.network_id_to_code(network)
778
- isDefault = self.safe_bool(rawNetwork, 'isDefault')
779
- networkDepositEnabled = self.safe_bool(rawNetwork, 'depositEnable')
780
- if networkDepositEnabled:
781
- depositEnabled = True
782
- networkWithdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
783
- if networkWithdrawEnabled:
784
- withdrawEnabled = True
785
774
  limits: dict = {
786
775
  'withdraw': {
787
776
  'min': self.safe_number(rawNetwork, 'withdrawMin'),
788
777
  'max': self.safe_number(rawNetwork, 'withdrawMax'),
789
778
  },
790
779
  }
791
- fee = self.safe_number(rawNetwork, 'withdrawFee')
792
- if isDefault:
793
- defaultLimits = limits
794
- precision = self.safe_number(rawNetwork, 'withdrawPrecision')
795
- networkActive = networkDepositEnabled or networkWithdrawEnabled
780
+ precision = self.parse_number(self.parse_precision(self.safe_string(rawNetwork, 'withdrawPrecision')))
796
781
  networks[networkCode] = {
797
782
  'info': rawNetwork,
798
783
  'id': network,
799
784
  'network': networkCode,
800
- 'fee': fee,
801
- 'active': networkActive,
802
- 'deposit': networkDepositEnabled,
803
- 'withdraw': networkWithdrawEnabled,
785
+ 'fee': self.safe_number(rawNetwork, 'withdrawFee'),
786
+ 'active': None,
787
+ 'deposit': self.safe_bool(rawNetwork, 'depositEnable'),
788
+ 'withdraw': self.safe_bool(rawNetwork, 'withdrawEnable'),
804
789
  'precision': precision,
805
790
  'limits': limits,
806
791
  }
807
- active = depositEnabled or withdrawEnabled
808
792
  result[code] = self.safe_currency_structure({
809
793
  'info': entry,
810
794
  'code': code,
811
795
  'id': currencyId,
812
796
  'precision': None,
813
797
  'name': name,
814
- 'active': active,
815
- 'deposit': depositEnabled,
816
- 'withdraw': withdrawEnabled,
798
+ 'active': None,
799
+ 'deposit': None,
800
+ 'withdraw': None,
817
801
  'networks': networks,
818
- 'fee': fee,
819
- 'limits': defaultLimits,
802
+ 'fee': None,
803
+ 'limits': None,
804
+ 'type': 'crypto', # only cryptos now
820
805
  })
821
806
  return result
822
807
 
@@ -5536,18 +5521,14 @@ class bingx(Exchange, ImplicitAPI):
5536
5521
  :param str address: the address to withdraw to
5537
5522
  :param str [tag]:
5538
5523
  :param dict [params]: extra parameters specific to the exchange API endpoint
5539
- :param int [params.walletType]: 1 fund account, 2 standard account, 3 perpetual account
5524
+ :param int [params.walletType]: 1 fund account, 2 standard account, 3 perpetual account, 15 spot account
5540
5525
  :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
5541
5526
  """
5542
5527
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
5543
5528
  self.check_address(address)
5544
5529
  await self.load_markets()
5545
5530
  currency = self.currency(code)
5546
- walletType = self.safe_integer(params, 'walletType')
5547
- if walletType is None:
5548
- walletType = 1
5549
- if not self.in_array(walletType, [1, 2, 3]):
5550
- raise BadRequest(self.id + ' withdraw() requires either 1 fund account, 2 standard futures account, 3 perpetual account for walletType')
5531
+ walletType = self.safe_integer(params, 'walletType', 1)
5551
5532
  request: dict = {
5552
5533
  'coin': currency['id'],
5553
5534
  'address': address,
@@ -752,6 +752,7 @@ class bitfinex(Exchange, ImplicitAPI):
752
752
  'pub:map:currency:explorer', # maps symbols to their recognised block explorer URLs
753
753
  'pub:map:currency:tx:fee', # maps currencies to their withdrawal fees https://github.com/ccxt/ccxt/issues/7745,
754
754
  'pub:map:tx:method', # maps withdrawal/deposit methods to their API symbols
755
+ 'pub:info:tx:status', # maps withdrawal/deposit statuses, coins: 1 = enabled, 0 = maintenance
755
756
  ]
756
757
  config = ','.join(labels)
757
758
  request: dict = {
@@ -834,40 +835,81 @@ class bitfinex(Exchange, ImplicitAPI):
834
835
  # ["ABS",[0,131.3]],
835
836
  # ["ADA",[0,0.3]],
836
837
  # ],
838
+ # # deposit/withdrawal data
839
+ # [
840
+ # ["BITCOIN", 1, 1, null, null, null, null, 0, 0, null, null, 3],
841
+ # ...
842
+ # ]
837
843
  # ]
838
844
  #
839
845
  indexed: dict = {
840
- 'sym': self.index_by(self.safe_value(response, 1, []), 0),
841
- 'label': self.index_by(self.safe_value(response, 2, []), 0),
842
- 'unit': self.index_by(self.safe_value(response, 3, []), 0),
843
- 'undl': self.index_by(self.safe_value(response, 4, []), 0),
844
- 'pool': self.index_by(self.safe_value(response, 5, []), 0),
845
- 'explorer': self.index_by(self.safe_value(response, 6, []), 0),
846
- 'fees': self.index_by(self.safe_value(response, 7, []), 0),
846
+ 'sym': self.index_by(self.safe_list(response, 1, []), 0),
847
+ 'label': self.index_by(self.safe_list(response, 2, []), 0),
848
+ 'unit': self.index_by(self.safe_list(response, 3, []), 0),
849
+ 'undl': self.index_by(self.safe_list(response, 4, []), 0),
850
+ 'pool': self.index_by(self.safe_list(response, 5, []), 0),
851
+ 'explorer': self.index_by(self.safe_list(response, 6, []), 0),
852
+ 'fees': self.index_by(self.safe_list(response, 7, []), 0),
853
+ 'networks': self.safe_list(response, 8, []),
854
+ 'statuses': self.index_by(self.safe_list(response, 9, []), 0),
847
855
  }
848
- ids = self.safe_value(response, 0, [])
856
+ indexedNetworks: dict = {}
857
+ for i in range(0, len(indexed['networks'])):
858
+ networkObj = indexed['networks'][i]
859
+ networkId = self.safe_string(networkObj, 0)
860
+ valuesList = self.safe_list(networkObj, 1)
861
+ networkName = self.safe_string(valuesList, 0)
862
+ # for GOlang transpiler, do with "safe" method
863
+ networksList = self.safe_list(indexedNetworks, networkName, [])
864
+ networksList.append(networkId)
865
+ indexedNetworks[networkName] = networksList
866
+ ids = self.safe_list(response, 0, [])
849
867
  result: dict = {}
850
868
  for i in range(0, len(ids)):
851
869
  id = ids[i]
852
- if id.find('F0') >= 0:
870
+ if id.endswith('F0'):
853
871
  # we get a lot of F0 currencies, skip those
854
872
  continue
855
873
  code = self.safe_currency_code(id)
856
- label = self.safe_value(indexed['label'], id, [])
874
+ label = self.safe_list(indexed['label'], id, [])
857
875
  name = self.safe_string(label, 1)
858
- pool = self.safe_value(indexed['pool'], id, [])
876
+ pool = self.safe_list(indexed['pool'], id, [])
859
877
  rawType = self.safe_string(pool, 1)
860
878
  isCryptoCoin = (rawType is not None) or (id in indexed['explorer']) # "hacky" solution
861
879
  type = None
862
880
  if isCryptoCoin:
863
881
  type = 'crypto'
864
- feeValues = self.safe_value(indexed['fees'], id, [])
865
- fees = self.safe_value(feeValues, 1, [])
882
+ feeValues = self.safe_list(indexed['fees'], id, [])
883
+ fees = self.safe_list(feeValues, 1, [])
866
884
  fee = self.safe_number(fees, 1)
867
- undl = self.safe_value(indexed['undl'], id, [])
885
+ undl = self.safe_list(indexed['undl'], id, [])
868
886
  precision = '8' # default precision, todo: fix "magic constants"
869
887
  fid = 'f' + id
870
- result[code] = {
888
+ dwStatuses = self.safe_list(indexed['statuses'], id, [])
889
+ depositEnabled = self.safe_integer(dwStatuses, 1) == 1
890
+ withdrawEnabled = self.safe_integer(dwStatuses, 2) == 1
891
+ networks: dict = {}
892
+ netwokIds = self.safe_list(indexedNetworks, id, [])
893
+ for j in range(0, len(netwokIds)):
894
+ networkId = netwokIds[j]
895
+ network = self.network_id_to_code(networkId)
896
+ networks[network] = {
897
+ 'info': networkId,
898
+ 'id': networkId.lower(),
899
+ 'network': networkId,
900
+ 'active': None,
901
+ 'deposit': None,
902
+ 'withdraw': None,
903
+ 'fee': None,
904
+ 'precision': None,
905
+ 'limits': {
906
+ 'withdraw': {
907
+ 'min': None,
908
+ 'max': None,
909
+ },
910
+ },
911
+ }
912
+ result[code] = self.safe_currency_structure({
871
913
  'id': fid,
872
914
  'uppercaseId': id,
873
915
  'code': code,
@@ -875,8 +917,8 @@ class bitfinex(Exchange, ImplicitAPI):
875
917
  'type': type,
876
918
  'name': name,
877
919
  'active': True,
878
- 'deposit': None,
879
- 'withdraw': None,
920
+ 'deposit': depositEnabled,
921
+ 'withdraw': withdrawEnabled,
880
922
  'fee': fee,
881
923
  'precision': int(precision),
882
924
  'limits': {
@@ -889,37 +931,8 @@ class bitfinex(Exchange, ImplicitAPI):
889
931
  'max': None,
890
932
  },
891
933
  },
892
- 'networks': {},
893
- }
894
- networks: dict = {}
895
- currencyNetworks = self.safe_value(response, 8, [])
896
- cleanId = id.replace('F0', '')
897
- for j in range(0, len(currencyNetworks)):
898
- pair = currencyNetworks[j]
899
- networkId = self.safe_string(pair, 0)
900
- currencyId = self.safe_string(self.safe_value(pair, 1, []), 0)
901
- if currencyId == cleanId:
902
- network = self.network_id_to_code(networkId)
903
- networks[network] = {
904
- 'info': networkId,
905
- 'id': networkId.lower(),
906
- 'network': networkId,
907
- 'active': None,
908
- 'deposit': None,
909
- 'withdraw': None,
910
- 'fee': None,
911
- 'precision': None,
912
- 'limits': {
913
- 'withdraw': {
914
- 'min': None,
915
- 'max': None,
916
- },
917
- },
918
- }
919
- keysNetworks = list(networks.keys())
920
- networksLength = len(keysNetworks)
921
- if networksLength > 0:
922
- result[code]['networks'] = networks
934
+ 'networks': networks,
935
+ })
923
936
  return result
924
937
 
925
938
  async def fetch_balance(self, params={}) -> Balances:
@@ -3408,6 +3408,7 @@ class bitget(Exchange, ImplicitAPI):
3408
3408
  :param dict [params]: extra parameters specific to the exchange API endpoint
3409
3409
  :param int [params.until]: timestamp in ms of the latest candle to fetch
3410
3410
  :param boolean [params.useHistoryEndpoint]: whether to force to use historical endpoint(it has max limit of 200)
3411
+ :param boolean [params.useHistoryEndpointForPagination]: whether to force to use historical endpoint for pagination(default True)
3411
3412
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3412
3413
  :param str [params.price]: *swap only* "mark"(to fetch mark price candles) or "index"(to fetch index price candles)
3413
3414
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
@@ -3416,11 +3417,13 @@ class bitget(Exchange, ImplicitAPI):
3416
3417
  defaultLimit = 100 # default 100, max 1000
3417
3418
  maxLimitForRecentEndpoint = 1000
3418
3419
  maxLimitForHistoryEndpoint = 200 # note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
3420
+ useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
3421
+ useHistoryEndpointForPagination = self.safe_bool(params, 'useHistoryEndpointForPagination', True)
3419
3422
  paginate = False
3420
3423
  paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
3421
3424
  if paginate:
3422
- return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForRecentEndpoint)
3423
- useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
3425
+ limitForPagination = maxLimitForHistoryEndpoint if useHistoryEndpointForPagination else maxLimitForRecentEndpoint
3426
+ return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, limitForPagination)
3424
3427
  market = self.market(symbol)
3425
3428
  marketType = 'spot' if market['spot'] else 'swap'
3426
3429
  timeframes = self.options['timeframes'][marketType]
@@ -4039,6 +4042,7 @@ class bitget(Exchange, ImplicitAPI):
4039
4042
  timestamp = self.safe_integer_2(order, 'cTime', 'ctime')
4040
4043
  updateTimestamp = self.safe_integer(order, 'uTime')
4041
4044
  rawStatus = self.safe_string_2(order, 'status', 'state')
4045
+ rawStatus = self.safe_string(order, 'planStatus', rawStatus)
4042
4046
  fee = None
4043
4047
  feeCostString = self.safe_string(order, 'fee')
4044
4048
  if feeCostString is not None:
@@ -1705,6 +1705,7 @@ class bybit(Exchange, ImplicitAPI):
1705
1705
  },
1706
1706
  },
1707
1707
  'networks': networks,
1708
+ 'type': 'crypto', # atm exchange api provides only cryptos
1708
1709
  }
1709
1710
  return result
1710
1711
 
@@ -2128,6 +2129,7 @@ class bybit(Exchange, ImplicitAPI):
2128
2129
  strike = self.safe_string(splitId, 2)
2129
2130
  optionLetter = self.safe_string(splitId, 3)
2130
2131
  isActive = (status == 'Trading')
2132
+ isInverse = base == settle
2131
2133
  if isActive or (self.options['loadAllOptions']) or (self.options['loadExpiredOptions']):
2132
2134
  result.append(self.safe_market_structure({
2133
2135
  'id': id,
@@ -2147,8 +2149,8 @@ class bybit(Exchange, ImplicitAPI):
2147
2149
  'option': True,
2148
2150
  'active': isActive,
2149
2151
  'contract': True,
2150
- 'linear': None,
2151
- 'inverse': None,
2152
+ 'linear': not isInverse,
2153
+ 'inverse': isInverse,
2152
2154
  'taker': self.safe_number(market, 'takerFee', self.parse_number('0.0006')),
2153
2155
  'maker': self.safe_number(market, 'makerFee', self.parse_number('0.0001')),
2154
2156
  'contractSize': self.parse_number('1'),
ccxt/async_support/htx.py CHANGED
@@ -6946,7 +6946,7 @@ class htx(Exchange, ImplicitAPI):
6946
6946
  if method != 'POST':
6947
6947
  request = self.extend(request, query)
6948
6948
  sortedRequest = self.keysort(request)
6949
- auth = self.urlencode(sortedRequest)
6949
+ auth = self.urlencode(sortedRequest, True) # True is a go only requirment
6950
6950
  # unfortunately, PHP demands double quotes for the escaped newline symbol
6951
6951
  payload = "\n".join([method, self.hostname, url, auth]) # eslint-disable-line quotes
6952
6952
  signature = self.hmac(self.encode(payload), self.encode(self.secret), hashlib.sha256, 'base64')
@@ -7012,7 +7012,7 @@ class htx(Exchange, ImplicitAPI):
7012
7012
  if method != 'POST':
7013
7013
  sortedQuery = self.keysort(query)
7014
7014
  request = self.extend(request, sortedQuery)
7015
- auth = self.urlencode(request).replace('%2c', '%2C') # in c# it manually needs to be uppercased
7015
+ auth = self.urlencode(request, True).replace('%2c', '%2C') # in c# it manually needs to be uppercased
7016
7016
  # unfortunately, PHP demands double quotes for the escaped newline symbol
7017
7017
  payload = "\n".join([method, hostname, url, auth]) # eslint-disable-line quotes
7018
7018
  signature = self.hmac(self.encode(payload), self.encode(self.secret), hashlib.sha256, 'base64')