chore: use instance attribute throughout
This commit is contained in:
@@ -203,19 +203,21 @@ class Exchange:
|
||||
|
||||
# Leverage properties
|
||||
self.trading_mode: TradingMode = TradingMode(
|
||||
config.get("trading_mode", self._supported_trading_mode_margin_pairs[0][0])
|
||||
self._config.get("trading_mode", self._supported_trading_mode_margin_pairs[0][0])
|
||||
)
|
||||
self.margin_mode: MarginMode = MarginMode(
|
||||
MarginMode(config.get("margin_mode"))
|
||||
if config.get("margin_mode")
|
||||
MarginMode(self._config.get("margin_mode"))
|
||||
if self._config.get("margin_mode")
|
||||
else self._supported_trading_mode_margin_pairs[0][1]
|
||||
)
|
||||
config["trading_mode"] = self.trading_mode
|
||||
config["margin_mode"] = self.margin_mode
|
||||
config["candle_type_def"] = CandleType.get_default(self.trading_mode)
|
||||
self.liquidation_buffer = config.get("liquidation_buffer", 0.05)
|
||||
self._config["trading_mode"] = self.trading_mode
|
||||
self._config["margin_mode"] = self.margin_mode
|
||||
self._config["candle_type_def"] = CandleType.get_default(self.trading_mode)
|
||||
self.liquidation_buffer = self._config.get("liquidation_buffer", 0.05)
|
||||
|
||||
exchange_conf: ExchangeConfig = exchange_config if exchange_config else config["exchange"]
|
||||
exchange_conf: ExchangeConfig = (
|
||||
exchange_config if exchange_config else self._config["exchange"]
|
||||
)
|
||||
|
||||
# Deep merge ft_has with default ft_has options
|
||||
# Must be called before ft_has is used.
|
||||
@@ -246,14 +248,14 @@ class Exchange:
|
||||
# Holds all open sell orders for dry_run
|
||||
self._dry_run_open_orders: dict[str, Any] = {}
|
||||
|
||||
if config["dry_run"]:
|
||||
if self._config["dry_run"]:
|
||||
logger.info("Instance is running with dry_run enabled")
|
||||
logger.info(f"Using CCXT {ccxt.__version__}")
|
||||
|
||||
# Don't remove exchange credentials for dry-run or if always_require_api_keys is set
|
||||
remove_exchange_credentials(
|
||||
exchange_conf,
|
||||
not self._ft_has["always_require_api_keys"] and config.get("dry_run", False),
|
||||
not self._ft_has["always_require_api_keys"] and self._config.get("dry_run", False),
|
||||
)
|
||||
self.log_responses = exchange_conf.get("log_responses", False)
|
||||
|
||||
@@ -294,7 +296,7 @@ class Exchange:
|
||||
if validate:
|
||||
# Initial markets load
|
||||
self.reload_markets(True, load_leverage_tiers=False)
|
||||
self.validate_config(config)
|
||||
self.validate_config(self._config)
|
||||
|
||||
if self.trading_mode != TradingMode.SPOT and load_leverage_tiers:
|
||||
self.fill_leverage_tiers()
|
||||
|
||||
Reference in New Issue
Block a user