bitget 0.0.66__py3-none-any.whl → 0.0.69__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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.87'
7
+ __version__ = '4.4.90'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -906,6 +906,10 @@ class Exchange(object):
906
906
  def keysort(dictionary):
907
907
  return collections.OrderedDict(sorted(dictionary.items(), key=lambda t: t[0]))
908
908
 
909
+ @staticmethod
910
+ def sort(array):
911
+ return sorted(array)
912
+
909
913
  @staticmethod
910
914
  def extend(*args):
911
915
  if args is not None:
@@ -956,6 +960,11 @@ class Exchange(object):
956
960
  def groupBy(array, key):
957
961
  return Exchange.group_by(array, key)
958
962
 
963
+
964
+ @staticmethod
965
+ def index_by_safe(array, key):
966
+ return Exchange.index_by(array, key) # wrapper for go
967
+
959
968
  @staticmethod
960
969
  def index_by(array, key):
961
970
  result = {}
@@ -1037,7 +1046,7 @@ class Exchange(object):
1037
1046
  return _urlencode.urlencode(result, quote_via=_urlencode.quote)
1038
1047
 
1039
1048
  @staticmethod
1040
- def rawencode(params={}):
1049
+ def rawencode(params={}, sort=False):
1041
1050
  return _urlencode.unquote(Exchange.urlencode(params))
1042
1051
 
1043
1052
  @staticmethod
@@ -1536,7 +1545,8 @@ class Exchange(object):
1536
1545
  currencies = self.fetch_currencies()
1537
1546
  self.options['cachedCurrencies'] = currencies
1538
1547
  markets = self.fetch_markets(params)
1539
- del self.options['cachedCurrencies']
1548
+ if 'cachedCurrencies' in self.options:
1549
+ del self.options['cachedCurrencies']
1540
1550
  return self.set_markets(markets, currencies)
1541
1551
 
1542
1552
  def fetch_markets(self, params={}):
@@ -3186,7 +3196,7 @@ class Exchange(object):
3186
3196
 
3187
3197
  def set_markets(self, markets, currencies=None):
3188
3198
  values = []
3189
- self.markets_by_id = {}
3199
+ self.markets_by_id = self.create_safe_dictionary()
3190
3200
  # handle marketId conflicts
3191
3201
  # we insert spot markets first
3192
3202
  marketValues = self.sort_by(self.to_array(markets), 'spot', True, True)
@@ -3261,7 +3271,7 @@ class Exchange(object):
3261
3271
  resultingCurrencies.append(highestPrecisionCurrency)
3262
3272
  sortedCurrencies = self.sort_by(resultingCurrencies, 'code')
3263
3273
  self.currencies = self.deep_extend(self.currencies, self.index_by(sortedCurrencies, 'code'))
3264
- self.currencies_by_id = self.index_by(self.currencies, 'id')
3274
+ self.currencies_by_id = self.index_by_safe(self.currencies, 'id')
3265
3275
  currenciesSortedByCode = self.keysort(self.currencies)
3266
3276
  self.codes = list(currenciesSortedByCode.keys())
3267
3277
  return self.markets