first test done
This commit is contained in:
@@ -129,6 +129,7 @@ class RecursiveAnalysis(BaseAnalysis):
|
|||||||
varholder.indicators = backtesting.strategy.advise_all_indicators(varholder.data)
|
varholder.indicators = backtesting.strategy.advise_all_indicators(varholder.data)
|
||||||
|
|
||||||
def fill_partial_varholder(self, start_date, startup_candle):
|
def fill_partial_varholder(self, start_date, startup_candle):
|
||||||
|
logger.info(f"Calculating indicators using startup candle of {startup_candle}.")
|
||||||
partial_varHolder = VarHolder()
|
partial_varHolder = VarHolder()
|
||||||
|
|
||||||
partial_varHolder.from_dt = start_date
|
partial_varHolder.from_dt = start_date
|
||||||
@@ -142,6 +143,8 @@ class RecursiveAnalysis(BaseAnalysis):
|
|||||||
self.partial_varHolder_array.append(partial_varHolder)
|
self.partial_varHolder_array.append(partial_varHolder)
|
||||||
|
|
||||||
def fill_partial_varholder_lookahead(self, end_date):
|
def fill_partial_varholder_lookahead(self, end_date):
|
||||||
|
logger.info("Calculating indicators to test lookahead on indicators.")
|
||||||
|
|
||||||
partial_varHolder = VarHolder()
|
partial_varHolder = VarHolder()
|
||||||
|
|
||||||
partial_varHolder.from_dt = self.full_varHolder.from_dt
|
partial_varHolder.from_dt = self.full_varHolder.from_dt
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import pytest
|
|||||||
from freqtrade.commands.optimize_commands import start_recursive_analysis
|
from freqtrade.commands.optimize_commands import start_recursive_analysis
|
||||||
from freqtrade.data.history import get_timerange
|
from freqtrade.data.history import get_timerange
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.optimize.recursive_analysis import Analysis, RecursiveAnalysis
|
from freqtrade.optimize.recursive_analysis import RecursiveAnalysis
|
||||||
from freqtrade.optimize.recursive_analysis_helpers import RecursiveAnalysisSubFunctions
|
from freqtrade.optimize.recursive_analysis_helpers import RecursiveAnalysisSubFunctions
|
||||||
from tests.conftest import EXMS, get_args, log_has_re, patch_exchange
|
from tests.conftest import EXMS, get_args, log_has_re, patch_exchange
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ def test_biased_strategy(recursive_conf, mocker, caplog, scenario) -> None:
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
||||||
PropertyMock(return_value=['UNITTEST/BTC']))
|
PropertyMock(return_value=['UNITTEST/BTC']))
|
||||||
recursive_conf['pairs'] = ['UNITTEST/USDT']
|
recursive_conf['pairs'] = ['UNITTEST/BTC']
|
||||||
|
|
||||||
recursive_conf['timeframe'] = '5m'
|
recursive_conf['timeframe'] = '5m'
|
||||||
recursive_conf['timerange'] = '20180119-20180122'
|
recursive_conf['timerange'] = '20180119-20180122'
|
||||||
@@ -362,7 +362,7 @@ def test_biased_strategy(recursive_conf, mocker, caplog, scenario) -> None:
|
|||||||
# Assert init correct
|
# Assert init correct
|
||||||
assert log_has_re(f"Strategy Parameter: scenario = {scenario}", caplog)
|
assert log_has_re(f"Strategy Parameter: scenario = {scenario}", caplog)
|
||||||
|
|
||||||
diff_pct = float(instance.dict_recursive['rsi'][100].replace("%", ""))
|
diff_pct = abs(float(instance.dict_recursive['rsi'][100].replace("%", "")))
|
||||||
# check non-biased strategy
|
# check non-biased strategy
|
||||||
if scenario == "no_bias":
|
if scenario == "no_bias":
|
||||||
assert diff_pct < 0.01
|
assert diff_pct < 0.01
|
||||||
|
|||||||
Reference in New Issue
Block a user