mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-15 04:33:57 +00:00
fix spice-rack test
This commit is contained in:
parent
a7312dec03
commit
12a9fda885
|
@ -205,12 +205,22 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||||
new_corr_pairs = []
|
new_corr_pairs = []
|
||||||
new_tfs = []
|
new_tfs = []
|
||||||
|
|
||||||
|
if not self.dp:
|
||||||
|
logger.warning('No dataprovider available.')
|
||||||
|
config['freqai']['enabled'] = False
|
||||||
|
return config
|
||||||
# find the closest pairs to what the default config wants
|
# find the closest pairs to what the default config wants
|
||||||
for pair in corr_pairs:
|
for pair in corr_pairs:
|
||||||
closest_pair = difflib.get_close_matches(
|
closest_pair = difflib.get_close_matches(
|
||||||
pair,
|
pair,
|
||||||
self.dp._exchange.markets # type: ignore
|
self.dp._exchange.markets # type: ignore
|
||||||
)[0]
|
)
|
||||||
|
if not closest_pair:
|
||||||
|
logger.warning(f'Could not find {pair} in markets, removing from '
|
||||||
|
f'corr_pairlist.')
|
||||||
|
else:
|
||||||
|
closest_pair = closest_pair[0]
|
||||||
|
|
||||||
new_corr_pairs.append(closest_pair)
|
new_corr_pairs.append(closest_pair)
|
||||||
logger.info(f'Spice rack will use {closest_pair} as informative in FreqAI model.')
|
logger.info(f'Spice rack will use {closest_pair} as informative in FreqAI model.')
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,11 @@ def test_principal_component_analysis(mocker, freqai_conf):
|
||||||
|
|
||||||
|
|
||||||
def test_spice_rack(mocker, default_conf, tmpdir):
|
def test_spice_rack(mocker, default_conf, tmpdir):
|
||||||
|
|
||||||
|
strategy = get_patched_freqai_strategy(mocker, default_conf)
|
||||||
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
|
strategy.dp = DataProvider(default_conf, exchange)
|
||||||
|
|
||||||
default_conf.update({"freqai_spice_rack": "true"})
|
default_conf.update({"freqai_spice_rack": "true"})
|
||||||
default_conf.update({"freqai_config": "test_config.json"})
|
default_conf.update({"freqai_config": "test_config.json"})
|
||||||
default_conf.update({"freqai_identifier": "spicy-id"})
|
default_conf.update({"freqai_identifier": "spicy-id"})
|
||||||
|
@ -330,6 +335,8 @@ def test_spice_rack(mocker, default_conf, tmpdir):
|
||||||
default_conf["user_data_dir"] = Path(tmpdir)
|
default_conf["user_data_dir"] = Path(tmpdir)
|
||||||
freqai_conf = copy.deepcopy(default_conf)
|
freqai_conf = copy.deepcopy(default_conf)
|
||||||
|
|
||||||
_ = get_patched_freqai_strategy(mocker, freqai_conf)
|
strategy.config = freqai_conf
|
||||||
|
strategy.load_freqAI_model()
|
||||||
|
|
||||||
assert 'freqai' in freqai_conf
|
assert 'freqai' in freqai_conf
|
||||||
|
assert strategy.freqai
|
||||||
|
|
Loading…
Reference in New Issue
Block a user