mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
perf: only create detail timedelta object once for detail backtests
This commit is contained in:
parent
ad121c19b0
commit
0d14b7a800
|
@ -185,13 +185,14 @@ class Backtesting:
|
|||
# Load detail timeframe if specified
|
||||
self.timeframe_detail = str(self.config.get('timeframe_detail', ''))
|
||||
if self.timeframe_detail:
|
||||
self.timeframe_detail_min = timeframe_to_minutes(self.timeframe_detail)
|
||||
if self.timeframe_min <= self.timeframe_detail_min:
|
||||
timeframe_detail_min = timeframe_to_minutes(self.timeframe_detail)
|
||||
self.timeframe_detail_td = timedelta(minutes=timeframe_detail_min)
|
||||
if self.timeframe_min <= timeframe_detail_min:
|
||||
raise OperationalException(
|
||||
"Detail timeframe must be smaller than strategy timeframe.")
|
||||
|
||||
else:
|
||||
self.timeframe_detail_min = 0
|
||||
self.timeframe_detail_td = timedelta(seconds=0)
|
||||
self.detail_data: Dict[str, DataFrame] = {}
|
||||
self.futures_data: Dict[str, DataFrame] = {}
|
||||
|
||||
|
@ -1268,7 +1269,7 @@ class Backtesting:
|
|||
open_trade_count_start = self.backtest_loop(
|
||||
det_row, pair, current_time_det, end_date,
|
||||
open_trade_count_start, trade_dir, is_first)
|
||||
current_time_det += timedelta(minutes=self.timeframe_detail_min)
|
||||
current_time_det += self.timeframe_detail_td
|
||||
is_first = False
|
||||
else:
|
||||
self.dataprovider._set_dataframe_max_date(current_time)
|
||||
|
|
Loading…
Reference in New Issue
Block a user