gate-io-api 0.0.89__py3-none-any.whl → 0.0.90__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.

Potentially problematic release.


This version of gate-io-api might be problematic. Click here for more details.

gate/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.5.5'
29
+ __version__ = '4.5.6'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.5'
11
+ __version__ = '4.5.6'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.5.5'
5
+ __version__ = '4.5.6'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1837,7 +1837,7 @@ class gate(Exchange, ImplicitAPI):
1837
1837
  # sandbox/testnet only supports future markets
1838
1838
  apiBackup = self.safe_value(self.urls, 'apiBackup')
1839
1839
  if apiBackup is not None:
1840
- return None
1840
+ return {}
1841
1841
  response = await self.publicSpotGetCurrencies(params)
1842
1842
  #
1843
1843
  # [
gate/ccxt/base/errors.py CHANGED
@@ -1,9 +1,3 @@
1
- # ----------------------------------------------------------------------------
2
-
3
- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- # EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
1
  error_hierarchy = {
8
2
  'BaseError': {
9
3
  'ExchangeError': {
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.5.5'
7
+ __version__ = '4.5.6'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -311,8 +311,7 @@ class Exchange(object):
311
311
  bidsasks = None
312
312
  base_currencies = None
313
313
  quote_currencies = None
314
- currencies = None
315
-
314
+ currencies = {}
316
315
  options = None # Python does not allow to define properties in run-time with setattr
317
316
  isSandboxModeEnabled = False
318
317
  accounts = None
@@ -2591,6 +2590,22 @@ class Exchange(object):
2591
2590
  # set flag
2592
2591
  self.isSandboxModeEnabled = False
2593
2592
 
2593
+ def enable_demo_trading(self, enable: bool):
2594
+ """
2595
+ enables or disables demo trading mode
2596
+ :param boolean [enable]: True if demo trading should be enabled, False otherwise
2597
+ """
2598
+ if self.isSandboxModeEnabled:
2599
+ raise NotSupported(self.id + ' demo trading does not support in sandbox environment. Please check https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd to see the differences')
2600
+ if enable:
2601
+ self.urls['apiBackupDemoTrading'] = self.urls['api']
2602
+ self.urls['api'] = self.urls['demo']
2603
+ elif 'apiBackupDemoTrading' in self.urls:
2604
+ self.urls['api'] = self.urls['apiBackupDemoTrading']
2605
+ newUrls = self.omit(self.urls, 'apiBackupDemoTrading')
2606
+ self.urls = newUrls
2607
+ self.options['enableDemoTrading'] = enable
2608
+
2594
2609
  def sign(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None):
2595
2610
  return {}
2596
2611
 
@@ -3009,6 +3024,76 @@ class Exchange(object):
3009
3024
  featureBlock['symbolRequired'] = self.in_array(key, ['createOrder', 'createOrders', 'fetchOHLCV'])
3010
3025
  return featuresObj
3011
3026
 
3027
+ def feature_value(self, symbol: str, methodName: Str = None, paramName: Str = None, subParamName: Str = None, defaultValue: Any = None):
3028
+ """
3029
+ self method is a very deterministic to help users to know what feature is supported by the exchange
3030
+ :param str [symbol]: unified symbol
3031
+ :param str [methodName]: view currently supported methods: https://docs.ccxt.com/#/README?id=features
3032
+ :param str [paramName]: unified param value(check docs for supported param names)
3033
+ :param str [subParamName]: unified sub-param value(eg. stopLoss->triggerPriceType)
3034
+ :param dict [defaultValue]: return default value if no result found
3035
+ :returns dict: returns feature value
3036
+ """
3037
+ market = self.market(symbol)
3038
+ return self.feature_value_by_type(market['type'], market['subType'], methodName, paramName, subParamName, defaultValue)
3039
+
3040
+ def feature_value_by_type(self, marketType: str, subType: Str, methodName: Str = None, paramName: Str = None, subParamName: Str = None, defaultValue: Any = None):
3041
+ """
3042
+ self method is a very deterministic to help users to know what feature is supported by the exchange
3043
+ :param str [marketType]: supported only: "spot", "swap", "future"
3044
+ :param str [subType]: supported only: "linear", "inverse"
3045
+ :param str [methodName]: view currently supported methods: https://docs.ccxt.com/#/README?id=features
3046
+ :param str [paramName]: unified param value(check docs for supported param names)
3047
+ :param str [subParamName]: unified sub-param value(eg. stopLoss->triggerPriceType)
3048
+ :param dict [defaultValue]: return default value if no result found
3049
+ :returns dict: returns feature value
3050
+ """
3051
+ # if exchange does not yet have features manually implemented
3052
+ if self.features is None:
3053
+ return defaultValue
3054
+ # if marketType(e.g. 'option') does not exist in features
3055
+ if not (marketType in self.features):
3056
+ return defaultValue # unsupported marketType, check "exchange.features" for details
3057
+ # if marketType dict None
3058
+ if self.features[marketType] is None:
3059
+ return defaultValue
3060
+ methodsContainer = self.features[marketType]
3061
+ if subType is None:
3062
+ if marketType != 'spot':
3063
+ return defaultValue # subType is required for non-spot markets
3064
+ else:
3065
+ if not (subType in self.features[marketType]):
3066
+ return defaultValue # unsupported subType, check "exchange.features" for details
3067
+ # if subType dict None
3068
+ if self.features[marketType][subType] is None:
3069
+ return defaultValue
3070
+ methodsContainer = self.features[marketType][subType]
3071
+ # if user wanted only marketType and didn't provide methodName, eg: featureIsSupported('spot')
3072
+ if methodName is None:
3073
+ return methodsContainer
3074
+ if not (methodName in methodsContainer):
3075
+ return defaultValue # unsupported method, check "exchange.features" for details')
3076
+ methodDict = methodsContainer[methodName]
3077
+ if methodDict is None:
3078
+ return defaultValue
3079
+ # if user wanted only method and didn't provide `paramName`, eg: featureIsSupported('swap', 'linear', 'createOrder')
3080
+ if paramName is None:
3081
+ return methodDict
3082
+ if not (paramName in methodDict):
3083
+ return defaultValue # unsupported paramName, check "exchange.features" for details')
3084
+ dictionary = self.safe_dict(methodDict, paramName)
3085
+ if dictionary is None:
3086
+ # if the value is not dictionary but a scalar value(or None), return
3087
+ return methodDict[paramName]
3088
+ else:
3089
+ # return, when calling without `subParamName` eg: featureValueByType('spot', None, 'createOrder', 'stopLoss')
3090
+ if subParamName is None:
3091
+ return methodDict[paramName]
3092
+ # raise an exception for unsupported subParamName
3093
+ if not (subParamName in methodDict[paramName]):
3094
+ return defaultValue # unsupported subParamName, check "exchange.features" for details
3095
+ return methodDict[paramName][subParamName]
3096
+
3012
3097
  def orderbook_checksum_message(self, symbol: Str):
3013
3098
  return symbol + ' = False'
3014
3099
 
@@ -3275,7 +3360,11 @@ class Exchange(object):
3275
3360
  marketsSortedById = self.keysort(self.markets_by_id)
3276
3361
  self.symbols = list(marketsSortedBySymbol.keys())
3277
3362
  self.ids = list(marketsSortedById.keys())
3363
+ numCurrencies = 0
3278
3364
  if currencies is not None:
3365
+ keys = list(currencies.keys())
3366
+ numCurrencies = len(keys)
3367
+ if numCurrencies > 0:
3279
3368
  # currencies is always None when called in constructor but not when called from loadMarkets
3280
3369
  self.currencies = self.map_to_safe_map(self.deep_extend(self.currencies, currencies))
3281
3370
  else:
@@ -5659,7 +5748,9 @@ class Exchange(object):
5659
5748
  return self.safe_string(self.commonCurrencies, code, code)
5660
5749
 
5661
5750
  def currency(self, code: str):
5662
- if self.currencies is None:
5751
+ keys = list(self.currencies.keys())
5752
+ numCurrencies = len(keys)
5753
+ if numCurrencies == 0:
5663
5754
  raise ExchangeError(self.id + ' currencies not loaded')
5664
5755
  if isinstance(code, str):
5665
5756
  if code in self.currencies:
gate/ccxt/gate.py CHANGED
@@ -1836,7 +1836,7 @@ class gate(Exchange, ImplicitAPI):
1836
1836
  # sandbox/testnet only supports future markets
1837
1837
  apiBackup = self.safe_value(self.urls, 'apiBackup')
1838
1838
  if apiBackup is not None:
1839
- return None
1839
+ return {}
1840
1840
  response = self.publicSpotGetCurrencies(params)
1841
1841
  #
1842
1842
  # [
gate/ccxt/pro/__init__.py CHANGED
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.5'
11
+ __version__ = '4.5.6'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gate-io-api
3
- Version: 0.0.89
3
+ Version: 0.0.90
4
4
  Summary: gate crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -1,11 +1,11 @@
1
1
  gate/__init__.py,sha256=rmRavmagjlyk7Z5zGWWJiY8tfYIPsk04hRzC4SYJOzA,222
2
- gate/ccxt/__init__.py,sha256=PFkVSDcpB0bNe46DvY_3CN_irsG8-DZ4ogxctbFadgI,6126
3
- gate/ccxt/gate.py,sha256=twM0HtspU97B_EUDrojZZVRF-wIfCkdOn8q7bsDtnlg,354723
2
+ gate/ccxt/__init__.py,sha256=KZz2rKbIX8jGVWvyluyTXsYzZdgzmuruNBnpPlfede4,6126
3
+ gate/ccxt/gate.py,sha256=MfRouh3INstOZ0FzKB_vAImzTFfe9oNRcrZUS0p_XMY,354721
4
4
  gate/ccxt/abstract/gate.py,sha256=MrRMycFEpZKJ6yC7qi0p_qcwZtU9WJi5bBbVllskGoA,45044
5
- gate/ccxt/async_support/__init__.py,sha256=HJyuEBy1bx3cfrhl0FnA2jPSyGq8InU3cC3s3_L4DGY,4859
6
- gate/ccxt/async_support/gate.py,sha256=hmGrxNzI4w_gRdaLlVCEV0bV4gz3sd2tJH5rdXc-2jg,356688
5
+ gate/ccxt/async_support/__init__.py,sha256=jVq9B5k-dTT37Hzl-Cuzd7scM3ML9jWF5O_xi0qaxq8,4859
6
+ gate/ccxt/async_support/gate.py,sha256=KqvRPFWET-EiA1FdYfWXA61j-QcUpd60tNhStjgWP8Q,356686
7
7
  gate/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- gate/ccxt/async_support/base/exchange.py,sha256=zcjR7MUn8V80r5FKX8ifKeOXMg7cNSuEfxbhZ6PLteY,121432
8
+ gate/ccxt/async_support/base/exchange.py,sha256=6Zi61lSs9WMY3guxZ3kHr8pzDe6du_Sg2h2OS76CBXw,121432
9
9
  gate/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  gate/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  gate/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
@@ -16,11 +16,11 @@ gate/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_Hoz
16
16
  gate/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
17
17
  gate/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  gate/ccxt/base/decimal_to_precision.py,sha256=3XI30u9YudHbTA438397u5rkdlXa3atxwZEfUus3C4k,6803
19
- gate/ccxt/base/errors.py,sha256=OGhWNvNtRlJOzFx-n1x3ZjTnaPpfWH0Vc0xACS-MeDw,5012
20
- gate/ccxt/base/exchange.py,sha256=pEYq-RPWeigwt4gmtNlP-wF7G-KD4NsY28n6YYIvBTE,338594
19
+ gate/ccxt/base/errors.py,sha256=LdTTHPmxpeFHJze93mGl7I3maqTgN0y_1mJ6coWkXmA,4734
20
+ gate/ccxt/base/exchange.py,sha256=wn_4H8fZPOLHhDnWSZEpCMrQA2hzpPckzT2CuEfPEyk,343891
21
21
  gate/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  gate/ccxt/base/types.py,sha256=Gvbogh9i7pPH7Z18xesYeDPribqqwq8uKpOv-YODFBs,11505
23
- gate/ccxt/pro/__init__.py,sha256=Zrl_lD8Z44fz6rhLY4s1-HtoF_EX54XtEyhThFQzqSY,4173
23
+ gate/ccxt/pro/__init__.py,sha256=xx-N2JGK_kf6bY7I2fI6sZgoYJrz_AyI43pYd-fhgTE,4173
24
24
  gate/ccxt/pro/gate.py,sha256=Pl64TJO43NcLrqDGs2oU16bPfFqIjOHllJTkpGMuErI,89805
25
25
  gate/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  gate/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ gate/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX2u
281
281
  gate/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  gate/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  gate/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- gate_io_api-0.0.89.dist-info/METADATA,sha256=w_7Eiw3QQTuSuiGR4XoYNlSFmQoHTlDeCB9ODZQfgMg,26827
285
- gate_io_api-0.0.89.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- gate_io_api-0.0.89.dist-info/RECORD,,
284
+ gate_io_api-0.0.90.dist-info/METADATA,sha256=r_IA60VYLSi1OLYPE8Jw3_NqRPKKsRY8d8qEBW9Qb0M,26827
285
+ gate_io_api-0.0.90.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ gate_io_api-0.0.90.dist-info/RECORD,,