From 36de4518098944875d79d88fd4854104499786ea Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 10 Dec 2018 19:54:43 +0100 Subject: [PATCH] Remove class-level variables --- freqtrade/exchange/__init__.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index 65e912a1f..40ac9b58a 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -64,14 +64,8 @@ def retrier(f): class Exchange(object): - # Current selected exchange - _api: ccxt.Exchange = None - _api_async: ccxt_async.Exchange = None _conf: Dict = {} - # Holds all open sell orders for dry_run - _dry_run_open_orders: Dict[str, Any] = {} - def __init__(self, config: dict) -> None: """ Initializes this module with the given config, @@ -89,13 +83,17 @@ class Exchange(object): # Holds candles self.klines: Dict[str, Any] = {} + # Holds all open sell orders for dry_run + self._dry_run_open_orders: Dict[str, Any] = {} + if config['dry_run']: logger.info('Instance is running with dry_run enabled') exchange_config = config['exchange'] - self._api = self._init_ccxt(exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config')) - self._api_async = self._init_ccxt(exchange_config, ccxt_async, - ccxt_kwargs=exchange_config.get('ccxt_async_config')) + self._api: ccxt.Exchange = self._init_ccxt( + exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config')) + self._api_async: ccxt_async.Exchange = self._init_ccxt( + exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config')) logger.info('Using Exchange "%s"', self.name)