Remove unnecessary parameter to generate_text_table_sell_reason

This commit is contained in:
Matthias 2020-03-15 15:04:48 +01:00
parent 3b89e7d393
commit 328dbd3930
3 changed files with 9 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import logging
from copy import deepcopy from copy import deepcopy
from datetime import datetime, timedelta from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List, NamedTuple, Optional from typing import Any, Dict, List, NamedTuple, Optional, Tuple
import arrow import arrow
from pandas import DataFrame from pandas import DataFrame
@ -108,7 +108,7 @@ class Backtesting:
# And the regular "stoploss" function would not apply to that case # And the regular "stoploss" function would not apply to that case
self.strategy.order_types['stoploss_on_exchange'] = False self.strategy.order_types['stoploss_on_exchange'] = False
def load_bt_data(self): def load_bt_data(self) -> Tuple[Dict[str, DataFrame], TimeRange]:
timerange = TimeRange.parse_timerange(None if self.config.get( timerange = TimeRange.parse_timerange(None if self.config.get(
'timerange') is None else str(self.config.get('timerange'))) 'timerange') is None else str(self.config.get('timerange')))
@ -432,8 +432,7 @@ class Backtesting:
print(' BACKTESTING REPORT '.center(len(table.splitlines()[0]), '=')) print(' BACKTESTING REPORT '.center(len(table.splitlines()[0]), '='))
print(table) print(table)
table = generate_text_table_sell_reason(data, table = generate_text_table_sell_reason(stake_currency=self.config['stake_currency'],
stake_currency=self.config['stake_currency'],
max_open_trades=self.config['max_open_trades'], max_open_trades=self.config['max_open_trades'],
results=results) results=results)
if isinstance(table, str): if isinstance(table, str):

View File

@ -69,12 +69,12 @@ def generate_text_table(data: Dict[str, Dict], stake_currency: str, max_open_tra
floatfmt=floatfmt, tablefmt="orgtbl", stralign="right") # type: ignore floatfmt=floatfmt, tablefmt="orgtbl", stralign="right") # type: ignore
def generate_text_table_sell_reason( def generate_text_table_sell_reason(stake_currency: str, max_open_trades: int,
data: Dict[str, Dict], stake_currency: str, max_open_trades: int, results: DataFrame results: DataFrame) -> str:
) -> str:
""" """
Generate small table outlining Backtest results Generate small table outlining Backtest results
:param data: Dict of <pair: dataframe> containing data that was used during backtesting. :param stake_currency: Stakecurrency used
:param max_open_trades: Max_open_trades parameter
:param results: Dataframe containing the backtest results :param results: Dataframe containing the backtest results
:return: pretty printed table with tabulate as string :return: pretty printed table with tabulate as string
""" """

View File

@ -61,10 +61,8 @@ def test_generate_text_table_sell_reason(default_conf, mocker):
'| stop_loss | 1 | 0 | 0 | 1 |' '| stop_loss | 1 | 0 | 0 | 1 |'
' -10 | -10 | -0.2 | -5 |' ' -10 | -10 | -0.2 | -5 |'
) )
assert generate_text_table_sell_reason( assert generate_text_table_sell_reason(stake_currency='BTC', max_open_trades=2,
data={'ETH/BTC': {}}, results=results) == result_str
stake_currency='BTC', max_open_trades=2,
results=results) == result_str
def test_generate_text_table_strategy(default_conf, mocker): def test_generate_text_table_strategy(default_conf, mocker):