Extract generate_text_table_sell_reason from backtesting class

This commit is contained in:
Matthias
2020-01-02 07:28:30 +01:00
parent 18a53f4467
commit caec345c0b
3 changed files with 20 additions and 18 deletions

View File

@@ -19,7 +19,8 @@ from freqtrade.data.dataprovider import DataProvider
from freqtrade.data.history import get_timerange
from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.optimize import setup_configuration, start_backtesting
from freqtrade.optimize.backtest_reports import generate_text_table
from freqtrade.optimize.backtest_reports import (
generate_text_table, generate_text_table_sell_reason)
from freqtrade.optimize.backtesting import Backtesting
from freqtrade.state import RunMode
from freqtrade.strategy.default_strategy import DefaultStrategy
@@ -361,8 +362,6 @@ def test_tickerdata_to_dataframe_bt(default_conf, mocker, testdatadir) -> None:
def test_generate_text_table(default_conf, mocker):
patch_exchange(mocker)
# default_conf['max_open_trades'] = 2
# backtesting = Backtesting(default_conf)
results = pd.DataFrame(
{
@@ -392,7 +391,6 @@ def test_generate_text_table(default_conf, mocker):
def test_generate_text_table_sell_reason(default_conf, mocker):
patch_exchange(mocker)
backtesting = Backtesting(default_conf)
results = pd.DataFrame(
{
@@ -412,7 +410,7 @@ def test_generate_text_table_sell_reason(default_conf, mocker):
'| roi | 2 | 2 | 0 |\n'
'| stop_loss | 1 | 0 | 1 |'
)
assert backtesting._generate_text_table_sell_reason(
assert generate_text_table_sell_reason(
data={'ETH/BTC': {}}, results=results) == result_str