Add test for __informative_pairs_freqai
This commit is contained in:
parent
0aada271ca
commit
d62cef01be
@ -8,6 +8,7 @@ import pytest
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data.dataprovider import DataProvider
|
||||
from freqtrade.freqai.data_kitchen import FreqaiDataKitchen
|
||||
from freqtrade.plugins.pairlistmanager import PairListManager
|
||||
from tests.conftest import get_patched_exchange, log_has_re
|
||||
from tests.freqai.conftest import get_patched_freqai_strategy
|
||||
|
||||
@ -315,3 +316,27 @@ def test_principal_component_analysis(mocker, freqai_conf):
|
||||
assert Path(freqai.dk.data_path / f"{freqai.dk.model_filename}_pca_object.pkl")
|
||||
|
||||
shutil.rmtree(Path(freqai.dk.full_path))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('timeframes,corr_pairs', [
|
||||
(['5m'], ['ADA/BTC', 'DASH/BTC']),
|
||||
(['5m'], ['ADA/BTC', 'DASH/BTC']),
|
||||
(['5m', '15m'], ['ADA/BTC', 'DASH/BTC', 'ETH/USDT']),
|
||||
])
|
||||
def test_freqai_informative_pairs(mocker, freqai_conf, timeframes, corr_pairs):
|
||||
freqai_conf['freqai']['feature_parameters'].update({
|
||||
'include_timeframes': timeframes,
|
||||
'include_corr_pairlist': corr_pairs,
|
||||
|
||||
})
|
||||
strategy = get_patched_freqai_strategy(mocker, freqai_conf)
|
||||
exchange = get_patched_exchange(mocker, freqai_conf)
|
||||
pairlists = PairListManager(exchange, freqai_conf)
|
||||
strategy.dp = DataProvider(freqai_conf, exchange, pairlists)
|
||||
pairlist = strategy.dp.current_whitelist()
|
||||
|
||||
pairs_a = strategy.informative_pairs()
|
||||
assert len(pairs_a) == 0
|
||||
pairs_b = strategy.gather_informative_pairs()
|
||||
# we expect unique pairs * timeframes
|
||||
assert len(pairs_b) == len(set(pairlist + corr_pairs)) * len(timeframes)
|
||||
|
@ -43,19 +43,6 @@ class freqai_test_strat(IStrategy):
|
||||
)
|
||||
max_roi_time_long = IntParameter(0, 800, default=400, space="sell", optimize=False, load=True)
|
||||
|
||||
def informative_pairs(self):
|
||||
whitelist_pairs = self.dp.current_whitelist()
|
||||
corr_pairs = self.config["freqai"]["feature_parameters"]["include_corr_pairlist"]
|
||||
informative_pairs = []
|
||||
for tf in self.config["freqai"]["feature_parameters"]["include_timeframes"]:
|
||||
for pair in whitelist_pairs:
|
||||
informative_pairs.append((pair, tf))
|
||||
for pair in corr_pairs:
|
||||
if pair in whitelist_pairs:
|
||||
continue # avoid duplication
|
||||
informative_pairs.append((pair, tf))
|
||||
return informative_pairs
|
||||
|
||||
def populate_any_indicators(
|
||||
self, pair, df, tf, informative=None, set_generalized_indicators=False
|
||||
):
|
||||
|
Loading…
Reference in New Issue
Block a user