Merge branch 'develop' into timeframe

This commit is contained in:
Matthias
2020-06-15 06:35:55 +02:00
47 changed files with 893 additions and 367 deletions

View File

@@ -659,17 +659,17 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
mocker.patch('freqtrade.pairlist.pairlistmanager.PairListManager.whitelist',
PropertyMock(return_value=['UNITTEST/BTC']))
mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest', backtestmock)
gen_table_mock = MagicMock()
text_table_mock = MagicMock()
sell_reason_mock = MagicMock()
gen_strattable_mock = MagicMock()
gen_strat_summary = MagicMock()
strattable_mock = MagicMock()
strat_summary = MagicMock()
mocker.patch.multiple('freqtrade.optimize.optimize_reports',
generate_text_table=gen_table_mock,
generate_text_table_strategy=gen_strattable_mock,
text_table_bt_results=text_table_mock,
text_table_strategy=strattable_mock,
generate_pair_metrics=MagicMock(),
generate_sell_reason_stats=sell_reason_mock,
generate_strategy_metrics=gen_strat_summary,
generate_strategy_metrics=strat_summary,
)
patched_configuration_load_config_file(mocker, default_conf)
@@ -690,10 +690,10 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
start_backtesting(args)
# 2 backtests, 4 tables
assert backtestmock.call_count == 2
assert gen_table_mock.call_count == 4
assert gen_strattable_mock.call_count == 1
assert text_table_mock.call_count == 4
assert strattable_mock.call_count == 1
assert sell_reason_mock.call_count == 2
assert gen_strat_summary.call_count == 1
assert strat_summary.call_count == 1
# check the logs, that will contain the backtest result
exists = [

View File

@@ -7,13 +7,13 @@ from arrow import Arrow
from freqtrade.edge import PairInfo
from freqtrade.optimize.optimize_reports import (
generate_pair_metrics, generate_edge_table, generate_sell_reason_stats,
generate_text_table, generate_text_table_sell_reason, generate_strategy_metrics,
generate_text_table_strategy, store_backtest_result)
text_table_bt_results, text_table_sell_reason, generate_strategy_metrics,
text_table_strategy, store_backtest_result)
from freqtrade.strategy.interface import SellType
from tests.conftest import patch_exchange
def test_generate_text_table(default_conf, mocker):
def test_text_table_bt_results(default_conf, mocker):
results = pd.DataFrame(
{
@@ -40,8 +40,7 @@ def test_generate_text_table(default_conf, mocker):
pair_results = generate_pair_metrics(data={'ETH/BTC': {}}, stake_currency='BTC',
max_open_trades=2, results=results)
assert generate_text_table(pair_results,
stake_currency='BTC') == result_str
assert text_table_bt_results(pair_results, stake_currency='BTC') == result_str
def test_generate_pair_metrics(default_conf, mocker):
@@ -69,7 +68,7 @@ def test_generate_pair_metrics(default_conf, mocker):
pytest.approx(pair_results[-1]['profit_sum_pct']) == pair_results[-1]['profit_sum'] * 100)
def test_generate_text_table_sell_reason(default_conf):
def test_text_table_sell_reason(default_conf):
results = pd.DataFrame(
{
@@ -97,8 +96,8 @@ def test_generate_text_table_sell_reason(default_conf):
sell_reason_stats = generate_sell_reason_stats(max_open_trades=2,
results=results)
assert generate_text_table_sell_reason(sell_reason_stats=sell_reason_stats,
stake_currency='BTC') == result_str
assert text_table_sell_reason(sell_reason_stats=sell_reason_stats,
stake_currency='BTC') == result_str
def test_generate_sell_reason_stats(default_conf):
@@ -136,7 +135,7 @@ def test_generate_sell_reason_stats(default_conf):
assert stop_result['profit_mean_pct'] == round(stop_result['profit_mean'] * 100, 2)
def test_generate_text_table_strategy(default_conf, mocker):
def test_text_table_strategy(default_conf, mocker):
results = {}
results['TestStrategy1'] = pd.DataFrame(
{
@@ -178,7 +177,7 @@ def test_generate_text_table_strategy(default_conf, mocker):
max_open_trades=2,
all_results=results)
assert generate_text_table_strategy(strategy_results, 'BTC') == result_str
assert text_table_strategy(strategy_results, 'BTC') == result_str
def test_generate_edge_table(edge_conf, mocker):