Rename DefaultStrategy

This commit is contained in:
Matthias
2021-08-26 07:25:53 +02:00
parent df1c0540ab
commit 6d96b11279
23 changed files with 107 additions and 110 deletions

View File

@@ -155,7 +155,7 @@ def test_setup_optimize_configuration_without_arguments(mocker, default_conf, ca
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--export', 'none'
]
@@ -190,7 +190,7 @@ def test_setup_bt_configuration_with_arguments(mocker, default_conf, caplog) ->
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--datadir', '/foo/bar',
'--timeframe', '1m',
'--enable-position-stacking',
@@ -240,7 +240,7 @@ def test_setup_optimize_configuration_stake_amount(mocker, default_conf, caplog)
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--stake-amount', '1',
'--starting-balance', '2'
]
@@ -251,7 +251,7 @@ def test_setup_optimize_configuration_stake_amount(mocker, default_conf, caplog)
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--stake-amount', '1',
'--starting-balance', '0.5'
]
@@ -269,7 +269,7 @@ def test_start(mocker, fee, default_conf, caplog) -> None:
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
]
pargs = get_args(args)
start_backtesting(pargs)
@@ -302,7 +302,7 @@ def test_backtesting_init(mocker, default_conf, order_types) -> None:
def test_backtesting_init_no_timeframe(mocker, default_conf, caplog) -> None:
patch_exchange(mocker)
del default_conf['timeframe']
default_conf['strategy_list'] = ['DefaultStrategy',
default_conf['strategy_list'] = ['StrategyTestV2',
'SampleStrategy']
mocker.patch('freqtrade.exchange.Exchange.get_fee', MagicMock(return_value=0.5))
@@ -340,7 +340,7 @@ def test_data_to_dataframe_bt(default_conf, mocker, testdatadir) -> None:
assert len(processed['UNITTEST/BTC']) == 102
# Load strategy to compare the result between Backtesting function and strategy are the same
default_conf.update({'strategy': 'DefaultStrategy'})
default_conf.update({'strategy': 'StrategyTestV2'})
strategy = StrategyResolver.load_strategy(default_conf)
processed2 = strategy.advise_all_indicators(data)
@@ -473,7 +473,7 @@ def test_backtesting_pairlist_list(default_conf, mocker, caplog, testdatadir, ti
Backtesting(default_conf)
# Multiple strategies
default_conf['strategy_list'] = ['DefaultStrategy', 'TestStrategyLegacyV1']
default_conf['strategy_list'] = ['StrategyTestV2', 'TestStrategyLegacyV1']
with pytest.raises(OperationalException,
match='PrecisionFilter not allowed for backtesting multiple strategies.'):
Backtesting(default_conf)
@@ -837,7 +837,7 @@ def test_backtest_start_timerange(default_conf, mocker, caplog, testdatadir):
args = [
'backtesting',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--datadir', str(testdatadir),
'--timeframe', '1m',
'--timerange', '1510694220-1510700340',
@@ -908,7 +908,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
'--enable-position-stacking',
'--disable-max-market-positions',
'--strategy-list',
'DefaultStrategy',
'StrategyTestV2',
'TestStrategyLegacyV1',
]
args = get_args(args)
@@ -931,7 +931,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
'Backtesting with data from 2017-11-14 21:17:00 '
'up to 2017-11-14 22:58:00 (0 days).',
'Parameter --enable-position-stacking detected ...',
'Running backtesting for Strategy DefaultStrategy',
'Running backtesting for Strategy StrategyTestV2',
'Running backtesting for Strategy TestStrategyLegacyV1',
]
@@ -1012,7 +1012,7 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
'--enable-position-stacking',
'--disable-max-market-positions',
'--strategy-list',
'DefaultStrategy',
'StrategyTestV2',
'TestStrategyLegacyV1',
]
args = get_args(args)
@@ -1029,7 +1029,7 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
'Backtesting with data from 2017-11-14 21:17:00 '
'up to 2017-11-14 22:58:00 (0 days).',
'Parameter --enable-position-stacking detected ...',
'Running backtesting for Strategy DefaultStrategy',
'Running backtesting for Strategy StrategyTestV2',
'Running backtesting for Strategy TestStrategyLegacyV1',
]

View File

@@ -16,7 +16,7 @@ def test_setup_optimize_configuration_without_arguments(mocker, default_conf, ca
args = [
'edge',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
]
config = setup_optimize_configuration(get_args(args), RunMode.EDGE)
@@ -46,7 +46,7 @@ def test_setup_edge_configuration_with_arguments(mocker, edge_conf, caplog) -> N
args = [
'edge',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--datadir', '/foo/bar',
'--timeframe', '1m',
'--timerange', ':100',
@@ -80,7 +80,7 @@ def test_start(mocker, fee, edge_conf, caplog) -> None:
args = [
'edge',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
]
pargs = get_args(args)
start_edge(pargs)

View File

@@ -125,7 +125,7 @@ def test_setup_hyperopt_configuration_stake_amount(mocker, default_conf) -> None
args = [
'hyperopt',
'--config', 'config.json',
'--strategy', 'DefaultStrategy',
'--strategy', 'StrategyTestV2',
'--stake-amount', '1',
'--starting-balance', '0.5'
]

View File

@@ -167,7 +167,7 @@ def test__pprint_dict():
def test_get_strategy_filename(default_conf):
x = HyperoptTools.get_strategy_filename(default_conf, 'DefaultStrategy')
x = HyperoptTools.get_strategy_filename(default_conf, 'StrategyTestV2')
assert isinstance(x, Path)
assert x == Path(__file__).parents[1] / 'strategy/strats/default_strategy.py'
@@ -177,7 +177,7 @@ def test_get_strategy_filename(default_conf):
def test_export_params(tmpdir):
filename = Path(tmpdir) / "DefaultStrategy.json"
filename = Path(tmpdir) / "StrategyTestV2.json"
assert not filename.is_file()
params = {
"params_details": {
@@ -205,12 +205,12 @@ def test_export_params(tmpdir):
}
}
HyperoptTools.export_params(params, "DefaultStrategy", filename)
HyperoptTools.export_params(params, "StrategyTestV2", filename)
assert filename.is_file()
content = rapidjson.load(filename.open('r'))
assert content['strategy_name'] == 'DefaultStrategy'
assert content['strategy_name'] == 'StrategyTestV2'
assert 'params' in content
assert "buy" in content["params"]
assert "sell" in content["params"]
@@ -223,7 +223,7 @@ def test_try_export_params(default_conf, tmpdir, caplog, mocker):
default_conf['disableparamexport'] = False
export_mock = mocker.patch("freqtrade.optimize.hyperopt_tools.HyperoptTools.export_params")
filename = Path(tmpdir) / "DefaultStrategy.json"
filename = Path(tmpdir) / "StrategyTestV2.json"
assert not filename.is_file()
params = {
"params_details": {
@@ -252,16 +252,16 @@ def test_try_export_params(default_conf, tmpdir, caplog, mocker):
FTHYPT_FILEVERSION: 2,
}
HyperoptTools.try_export_params(default_conf, "DefaultStrategy22", params)
HyperoptTools.try_export_params(default_conf, "StrategyTestV222", params)
assert log_has("Strategy not found, not exporting parameter file.", caplog)
assert export_mock.call_count == 0
caplog.clear()
HyperoptTools.try_export_params(default_conf, "DefaultStrategy", params)
HyperoptTools.try_export_params(default_conf, "StrategyTestV2", params)
assert export_mock.call_count == 1
assert export_mock.call_args_list[0][0][1] == 'DefaultStrategy'
assert export_mock.call_args_list[0][0][1] == 'StrategyTestV2'
assert export_mock.call_args_list[0][0][2].name == 'default_strategy.json'

View File

@@ -52,7 +52,7 @@ def test_text_table_bt_results():
def test_generate_backtest_stats(default_conf, testdatadir, tmpdir):
default_conf.update({'strategy': 'DefaultStrategy'})
default_conf.update({'strategy': 'StrategyTestV2'})
StrategyResolver.load_strategy(default_conf)
results = {'DefStrat': {