Skip to content

Commit 3d24ef6

Browse files
committed
refactor: have backtesting init use self.config instead of the passed in config
1 parent ef0fc13 commit 3d24ef6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

freqtrade/optimize/backtesting.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, config: Config, exchange: Exchange | None = None) -> None:
124124
self.trade_id_counter: int = 0
125125
self.order_id_counter: int = 0
126126

127-
config["dry_run"] = True
127+
self.config["dry_run"] = True
128128
self.price_pair_prec: dict[str, Series] = {}
129129
self.run_ids: dict[str, str] = {}
130130
self.strategylist: list[IStrategy] = []
@@ -180,8 +180,8 @@ def __init__(self, config: Config, exchange: Exchange | None = None) -> None:
180180
if len(self.pairlists.whitelist) == 0:
181181
raise OperationalException("No pair in whitelist.")
182182

183-
if config.get("fee", None) is not None:
184-
self.fee = config["fee"]
183+
if self.config.get("fee", None) is not None:
184+
self.fee = self.config["fee"]
185185
logger.info(f"Using fee {self.fee:.4%} from config.")
186186
else:
187187
fees = [
@@ -217,8 +217,8 @@ def __init__(self, config: Config, exchange: Exchange | None = None) -> None:
217217
# This value should NOT be written to startup_candle_count
218218
self.required_startup = self.dataprovider.get_required_startup(self.timeframe)
219219

220-
self.trading_mode: TradingMode = config.get("trading_mode", TradingMode.SPOT)
221-
self.margin_mode: MarginMode = config.get("margin_mode", MarginMode.ISOLATED)
220+
self.trading_mode: TradingMode = self.config.get("trading_mode", TradingMode.SPOT)
221+
self.margin_mode: MarginMode = self.config.get("margin_mode", MarginMode.ISOLATED)
222222
# strategies which define "can_short=True" will fail to load in Spot mode.
223223
self._can_short = self.trading_mode != TradingMode.SPOT
224224
self._position_stacking: bool = self.config.get("position_stacking", False)

0 commit comments

Comments
 (0)