mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 12:51:14 +00:00
refactor: have backtesting init use self.config instead of the passed in config
This commit is contained in:
@@ -124,7 +124,7 @@ class Backtesting:
|
|||||||
self.trade_id_counter: int = 0
|
self.trade_id_counter: int = 0
|
||||||
self.order_id_counter: int = 0
|
self.order_id_counter: int = 0
|
||||||
|
|
||||||
config["dry_run"] = True
|
self.config["dry_run"] = True
|
||||||
self.price_pair_prec: dict[str, Series] = {}
|
self.price_pair_prec: dict[str, Series] = {}
|
||||||
self.run_ids: dict[str, str] = {}
|
self.run_ids: dict[str, str] = {}
|
||||||
self.strategylist: list[IStrategy] = []
|
self.strategylist: list[IStrategy] = []
|
||||||
@@ -180,8 +180,8 @@ class Backtesting:
|
|||||||
if len(self.pairlists.whitelist) == 0:
|
if len(self.pairlists.whitelist) == 0:
|
||||||
raise OperationalException("No pair in whitelist.")
|
raise OperationalException("No pair in whitelist.")
|
||||||
|
|
||||||
if config.get("fee", None) is not None:
|
if self.config.get("fee", None) is not None:
|
||||||
self.fee = config["fee"]
|
self.fee = self.config["fee"]
|
||||||
logger.info(f"Using fee {self.fee:.4%} from config.")
|
logger.info(f"Using fee {self.fee:.4%} from config.")
|
||||||
else:
|
else:
|
||||||
fees = [
|
fees = [
|
||||||
@@ -217,8 +217,8 @@ class Backtesting:
|
|||||||
# This value should NOT be written to startup_candle_count
|
# This value should NOT be written to startup_candle_count
|
||||||
self.required_startup = self.dataprovider.get_required_startup(self.timeframe)
|
self.required_startup = self.dataprovider.get_required_startup(self.timeframe)
|
||||||
|
|
||||||
self.trading_mode: TradingMode = config.get("trading_mode", TradingMode.SPOT)
|
self.trading_mode: TradingMode = self.config.get("trading_mode", TradingMode.SPOT)
|
||||||
self.margin_mode: MarginMode = config.get("margin_mode", MarginMode.ISOLATED)
|
self.margin_mode: MarginMode = self.config.get("margin_mode", MarginMode.ISOLATED)
|
||||||
# strategies which define "can_short=True" will fail to load in Spot mode.
|
# strategies which define "can_short=True" will fail to load in Spot mode.
|
||||||
self._can_short = self.trading_mode != TradingMode.SPOT
|
self._can_short = self.trading_mode != TradingMode.SPOT
|
||||||
self._position_stacking: bool = self.config.get("position_stacking", False)
|
self._position_stacking: bool = self.config.get("position_stacking", False)
|
||||||
|
|||||||
Reference in New Issue
Block a user