Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

🐞 BugFix startup_candle_count #99

Merged
merged 3 commits into from
Aug 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions user_data/strategies/MasterMoniGoManiHyperStrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pandas import DataFrame
from scipy.interpolate import interp1d

from freqtrade.data.history import load_pair_history
from freqtrade.enums import RunMode
from freqtrade.exchange import timeframe_to_prev_date
from freqtrade.misc import deep_merge_dicts, round_dict
Expand Down Expand Up @@ -343,14 +344,12 @@ def __init__(self, config: dict):
self.mgm_logger('info', initialization, f'Current run mode detected as: HyperOpting/BackTesting. '
f'Auto updated is_dry_live_run_detected to: False')

self.mgm_logger('info', initialization,
f'Calculating and storing "timeframe_multiplier" + Updating startup_candle_count"')
self.mgm_logger('info', initialization, f'Calculating and storing "timeframe_multiplier"')
self.timeframe_multiplier = \
int(timeframe_to_minutes(self.informative_timeframe) / timeframe_to_minutes(self.timeframe))
if self.timeframe_multiplier < 1:
raise SystemExit(f'MoniGoManiHyperStrategy - ERROR - TimeFrame-Zoom - "timeframe" must be bigger than '
f'"backtest_timeframe"')
self.startup_candle_count *= self.timeframe_multiplier

else:
if os.path.isfile(self.mgm_config_hyperopt_path) is False:
Expand Down Expand Up @@ -469,9 +468,13 @@ def _populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFram
f'informative_timeframe ({self.informative_timeframe} candles) and '
f'a zoomed backtest_timeframe ({self.backtest_timeframe} candles)')

# Warning! This method gets ALL downloaded data that you have (when in backtesting mode).
# Warning! This method gets ALL downloaded data for the given timeframe (when in BackTesting mode).
# If you have many months or years downloaded for this pair, this will take a long time!
informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.informative_timeframe)
informative = load_pair_history(pair=metadata['pair'],
datadir=self.config['datadir'],
timeframe=self.informative_timeframe,
startup_candles=self.startup_candle_count,
data_format=self.config.get('dataformat_ohlcv', 'json'))

# Throw away older data that isn't needed.
first_informative = dataframe['date'].min().floor('H')
Expand Down