Reimplement adjustment of ccxt 'has' with more generic ccxt_config class attribute
This commit is contained in:
parent
e26bbc7de8
commit
6174a5dd55
@ -17,5 +17,6 @@ class Bibox(Exchange):
|
||||
may still not work as expected.
|
||||
"""
|
||||
|
||||
# Adjust ccxt exchange API metadata info
|
||||
_ccxt_has: Dict = {"fetchCurrencies": False}
|
||||
# fetchCurrencies API point requires authentication for Bibox,
|
||||
# so switch it off for Freqtrade load_markets()
|
||||
_ccxt_config: Dict = {"has": {"fetchCurrencies": False}}
|
||||
|
@ -30,8 +30,8 @@ class Exchange:
|
||||
|
||||
_config: Dict = {}
|
||||
|
||||
# Adjustments to ccxt exchange API metadata info (ccxt exchange `has` options)
|
||||
_ccxt_has: Dict = {}
|
||||
# Parameters to add directly to ccxt sync/async initialization.
|
||||
_ccxt_config: Dict = {}
|
||||
|
||||
# Parameters to add directly to buy/sell calls (like agreeing to trading agreement)
|
||||
_params: Dict = {}
|
||||
@ -94,10 +94,17 @@ class Exchange:
|
||||
self._trades_pagination_arg = self._ft_has['trades_pagination_arg']
|
||||
|
||||
# Initialize ccxt objects
|
||||
ccxt_config = self._ccxt_config.copy()
|
||||
ccxt_config = deep_merge_dicts(exchange_config.get('ccxt_config', {}),
|
||||
ccxt_config)
|
||||
self._api = self._init_ccxt(
|
||||
exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config'))
|
||||
exchange_config, ccxt_kwargs=ccxt_config)
|
||||
|
||||
ccxt_async_config = self._ccxt_config.copy()
|
||||
ccxt_async_config = deep_merge_dicts(exchange_config.get('ccxt_async_config', {}),
|
||||
ccxt_async_config)
|
||||
self._api_async = self._init_ccxt(
|
||||
exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config'))
|
||||
exchange_config, ccxt_async, ccxt_kwargs=ccxt_async_config)
|
||||
|
||||
logger.info('Using Exchange "%s"', self.name)
|
||||
|
||||
@ -155,10 +162,6 @@ class Exchange:
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(f"Initialization of ccxt failed. Reason: {e}") from e
|
||||
|
||||
# Adjust ccxt API metadata info (`has` options) for the exchange
|
||||
for k, v in self._ccxt_has.items():
|
||||
api.has[k] = v
|
||||
|
||||
self.set_sandbox(api, exchange_config, name)
|
||||
|
||||
return api
|
||||
|
Loading…
Reference in New Issue
Block a user