mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Remove bool from get_required_startup because its unused.
This commit is contained in:
@@ -329,7 +329,7 @@ class DataProvider:
|
|||||||
)
|
)
|
||||||
return self.__cached_pairs_backtesting[saved_pair].copy()
|
return self.__cached_pairs_backtesting[saved_pair].copy()
|
||||||
|
|
||||||
def get_required_startup(self, timeframe: str, add_train_candles: bool = True) -> int:
|
def get_required_startup(self, timeframe: str) -> int:
|
||||||
freqai_config = self._config.get('freqai', {})
|
freqai_config = self._config.get('freqai', {})
|
||||||
if not freqai_config.get('enabled', False):
|
if not freqai_config.get('enabled', False):
|
||||||
return self._config.get('startup_candle_count', 0)
|
return self._config.get('startup_candle_count', 0)
|
||||||
@@ -339,9 +339,7 @@ class DataProvider:
|
|||||||
# make sure the startupcandles is at least the set maximum indicator periods
|
# make sure the startupcandles is at least the set maximum indicator periods
|
||||||
self._config['startup_candle_count'] = max(startup_candles, max(indicator_periods))
|
self._config['startup_candle_count'] = max(startup_candles, max(indicator_periods))
|
||||||
tf_seconds = timeframe_to_seconds(timeframe)
|
tf_seconds = timeframe_to_seconds(timeframe)
|
||||||
train_candles = 0
|
train_candles = freqai_config['train_period_days'] * 86400 / tf_seconds
|
||||||
if add_train_candles:
|
|
||||||
train_candles = freqai_config['train_period_days'] * 86400 / tf_seconds
|
|
||||||
total_candles = int(self._config['startup_candle_count'] + train_candles)
|
total_candles = int(self._config['startup_candle_count'] + train_candles)
|
||||||
logger.info(
|
logger.info(
|
||||||
f'Increasing startup_candle_count for freqai on {timeframe} to {total_candles}')
|
f'Increasing startup_candle_count for freqai on {timeframe} to {total_candles}')
|
||||||
|
|||||||
@@ -508,16 +508,13 @@ def test_dp_get_required_startup(default_conf_usdt):
|
|||||||
dp = DataProvider(default_conf_usdt, None)
|
dp = DataProvider(default_conf_usdt, None)
|
||||||
|
|
||||||
# No FreqAI config
|
# No FreqAI config
|
||||||
assert dp.get_required_startup('5m', False) == 0
|
assert dp.get_required_startup('5m') == 0
|
||||||
assert dp.get_required_startup('1h', False) == 0
|
assert dp.get_required_startup('1h') == 0
|
||||||
assert dp.get_required_startup('1d', False) == 0
|
|
||||||
assert dp.get_required_startup('1d', True) == 0
|
|
||||||
assert dp.get_required_startup('1d') == 0
|
assert dp.get_required_startup('1d') == 0
|
||||||
|
|
||||||
dp._config['startup_candle_count'] = 20
|
dp._config['startup_candle_count'] = 20
|
||||||
assert dp.get_required_startup('5m', False) == 20
|
assert dp.get_required_startup('5m') == 20
|
||||||
assert dp.get_required_startup('5m', True) == 20
|
assert dp.get_required_startup('1h') == 20
|
||||||
assert dp.get_required_startup('1h', False) == 20
|
|
||||||
assert dp.get_required_startup('1h') == 20
|
assert dp.get_required_startup('1h') == 20
|
||||||
|
|
||||||
# With freqAI config
|
# With freqAI config
|
||||||
@@ -532,37 +529,19 @@ def test_dp_get_required_startup(default_conf_usdt):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert dp.get_required_startup('5m', False) == 20
|
assert dp.get_required_startup('5m') == 5780
|
||||||
assert dp.get_required_startup('5m', True) == 5780
|
assert dp.get_required_startup('1h') == 500
|
||||||
|
|
||||||
assert dp.get_required_startup('1h', False) == 20
|
|
||||||
assert dp.get_required_startup('1h', True) == 500
|
|
||||||
|
|
||||||
assert dp.get_required_startup('1d', False) == 20
|
|
||||||
assert dp.get_required_startup('1d', True) == 40
|
|
||||||
assert dp.get_required_startup('1d') == 40
|
assert dp.get_required_startup('1d') == 40
|
||||||
|
|
||||||
# FreqAI kindof ignores startup_candle_count if it's below indicator_periods_candles
|
# FreqAI kindof ignores startup_candle_count if it's below indicator_periods_candles
|
||||||
dp._config['startup_candle_count'] = 0
|
dp._config['startup_candle_count'] = 0
|
||||||
assert dp.get_required_startup('5m', False) == 20
|
assert dp.get_required_startup('5m') == 5780
|
||||||
assert dp.get_required_startup('5m', True) == 5780
|
assert dp.get_required_startup('1h') == 500
|
||||||
|
|
||||||
assert dp.get_required_startup('1h', False) == 20
|
|
||||||
assert dp.get_required_startup('1h', True) == 500
|
|
||||||
|
|
||||||
assert dp.get_required_startup('1d', False) == 20
|
|
||||||
assert dp.get_required_startup('1d', True) == 40
|
|
||||||
assert dp.get_required_startup('1d') == 40
|
assert dp.get_required_startup('1d') == 40
|
||||||
|
|
||||||
dp._config['freqai']['feature_parameters']['indicator_periods_candles'][1] = 50
|
dp._config['freqai']['feature_parameters']['indicator_periods_candles'][1] = 50
|
||||||
assert dp.get_required_startup('5m', False) == 50
|
assert dp.get_required_startup('5m') == 5810
|
||||||
assert dp.get_required_startup('5m', True) == 5810
|
assert dp.get_required_startup('1h') == 530
|
||||||
|
|
||||||
assert dp.get_required_startup('1h', False) == 50
|
|
||||||
assert dp.get_required_startup('1h', True) == 530
|
|
||||||
|
|
||||||
assert dp.get_required_startup('1d', False) == 50
|
|
||||||
assert dp.get_required_startup('1d', True) == 70
|
|
||||||
assert dp.get_required_startup('1d') == 70
|
assert dp.get_required_startup('1d') == 70
|
||||||
|
|
||||||
# scenario from issue https://github.com/freqtrade/freqtrade/issues/9432
|
# scenario from issue https://github.com/freqtrade/freqtrade/issues/9432
|
||||||
@@ -577,12 +556,6 @@ def test_dp_get_required_startup(default_conf_usdt):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dp._config['startup_candle_count'] = 40
|
dp._config['startup_candle_count'] = 40
|
||||||
assert dp.get_required_startup('5m', False) == 40
|
assert dp.get_required_startup('5m') == 51880
|
||||||
assert dp.get_required_startup('5m', True) == 51880
|
assert dp.get_required_startup('1h') == 4360
|
||||||
|
|
||||||
assert dp.get_required_startup('1h', False) == 40
|
|
||||||
assert dp.get_required_startup('1h', True) == 4360
|
|
||||||
|
|
||||||
assert dp.get_required_startup('1d', False) == 40
|
|
||||||
assert dp.get_required_startup('1d', True) == 220
|
|
||||||
assert dp.get_required_startup('1d') == 220
|
assert dp.get_required_startup('1d') == 220
|
||||||
|
|||||||
Reference in New Issue
Block a user