refactor StrategyResolver to work with class names

This commit is contained in:
gcarq
2018-03-24 20:44:04 +01:00
parent 6e5c14a95b
commit b4d2a3f495
12 changed files with 85 additions and 112 deletions

View File

@@ -174,7 +174,7 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
args = [
'--config', 'config.json',
'--strategy', 'default_strategy',
'--strategy', 'DefaultStrategy',
'backtesting'
]
@@ -215,7 +215,7 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
args = [
'--config', 'config.json',
'--strategy', 'default_strategy',
'--strategy', 'DefaultStrategy',
'--datadir', '/foo/bar',
'backtesting',
'--ticker-interval', '1',
@@ -277,7 +277,7 @@ def test_start(mocker, default_conf, caplog) -> None:
))
args = [
'--config', 'config.json',
'--strategy', 'default_strategy',
'--strategy', 'DefaultStrategy',
'backtesting'
]
args = get_args(args)
@@ -498,7 +498,7 @@ def test_backtest_ticks(default_conf):
def test_backtest_clash_buy_sell(default_conf):
# Override the default buy trend function in our default_strategy
# Override the default buy trend function in our DefaultStrategy
def fun(dataframe=None):
buy_value = 1
sell_value = 1
@@ -510,7 +510,7 @@ def test_backtest_clash_buy_sell(default_conf):
def test_backtest_only_sell(default_conf):
# Override the default buy trend function in our default_strategy
# Override the default buy trend function in our DefaultStrategy
def fun(dataframe=None):
buy_value = 0
sell_value = 1
@@ -578,12 +578,12 @@ def test_backtest_start_live(default_conf, mocker, caplog):
args.live = True
args.datadir = None
args.export = None
args.strategy = 'default_strategy'
args.strategy = 'DefaultStrategy'
args.timerange = '-100' # needed due to MagicMock malleability
args = [
'--config', 'config.json',
'--strategy', 'default_strategy',
'--strategy', 'DefaultStrategy',
'backtesting',
'--ticker-interval', '1',
'--live',

View File

@@ -57,12 +57,12 @@ def test_start(mocker, default_conf, caplog) -> None:
))
args = [
'--config', 'config.json',
'--strategy', 'default_strategy',
'--strategy', 'DefaultStrategy',
'hyperopt',
'--epochs', '5'
]
args = get_args(args)
StrategyResolver({'strategy': 'default_strategy'})
StrategyResolver({'strategy': 'DefaultStrategy'})
start(args)
import pprint
@@ -80,7 +80,7 @@ def test_loss_calculation_prefer_correct_trade_count() -> None:
Test Hyperopt.calculate_loss()
"""
hyperopt = _HYPEROPT
StrategyResolver({'strategy': 'default_strategy'})
StrategyResolver({'strategy': 'DefaultStrategy'})
correct = hyperopt.calculate_loss(1, hyperopt.target_trades, 20)
over = hyperopt.calculate_loss(1, hyperopt.target_trades + 100, 20)
@@ -171,7 +171,7 @@ def test_fmin_best_results(mocker, default_conf, caplog) -> None:
mocker.patch('freqtrade.optimize.hyperopt.hyperopt_optimize_conf', return_value=conf)
mocker.patch('freqtrade.logger.Logger.set_format', MagicMock())
StrategyResolver({'strategy': 'default_strategy'})
StrategyResolver({'strategy': 'DefaultStrategy'})
hyperopt = Hyperopt(conf)
hyperopt.trials = create_trials(mocker)
hyperopt.tickerdata_to_dataframe = MagicMock()
@@ -215,7 +215,7 @@ def test_fmin_throw_value_error(mocker, default_conf, caplog) -> None:
conf.update({'spaces': 'all'})
mocker.patch('freqtrade.optimize.hyperopt.hyperopt_optimize_conf', return_value=conf)
mocker.patch('freqtrade.logger.Logger.set_format', MagicMock())
StrategyResolver({'strategy': 'default_strategy'})
StrategyResolver({'strategy': 'DefaultStrategy'})
hyperopt = Hyperopt(conf)
hyperopt.trials = create_trials(mocker)
hyperopt.tickerdata_to_dataframe = MagicMock()
@@ -258,7 +258,7 @@ def test_resuming_previous_hyperopt_results_succeeds(mocker, default_conf) -> No
mocker.patch('freqtrade.optimize.hyperopt.hyperopt_optimize_conf', return_value=conf)
mocker.patch('freqtrade.logger.Logger.set_format', MagicMock())
StrategyResolver({'strategy': 'default_strategy'})
StrategyResolver({'strategy': 'DefaultStrategy'})
hyperopt = Hyperopt(conf)
hyperopt.trials = trials
hyperopt.tickerdata_to_dataframe = MagicMock()