diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index d6d016aba..d13708b90 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -33,7 +33,7 @@ def get_timeframe(data: Dict[str, DataFrame]) -> Tuple[arrow.Arrow, arrow.Arrow] def generate_text_table( - data: Dict[str, Dict], results: DataFrame, stake_currency, ticker_interval) -> str: + data: Dict[str, Dict], results: DataFrame, stake_currency) -> str: """ Generates and returns a text table for the given backtest data and the results dataframe :return: pretty printed table with tabulate as str @@ -49,7 +49,7 @@ def generate_text_table( len(result.index), result.profit_percent.mean() * 100.0, result.profit_BTC.sum(), - result.duration.mean() * ticker_interval, + result.duration.mean(), len(result[result.profit_BTC > 0]), len(result[result.profit_BTC < 0]) ]) @@ -60,7 +60,7 @@ def generate_text_table( len(results.index), results.profit_percent.mean() * 100.0, results.profit_BTC.sum(), - results.duration.mean() * ticker_interval, + results.duration.mean(), len(results[results.profit_BTC > 0]), len(results[results.profit_BTC < 0]) ]) @@ -91,7 +91,7 @@ def get_sell_trade_entry(pair, row, buy_subset, ticker, trade_count_lock, args): return row2, (pair, trade.calc_profit_percent(rate=row2.close), trade.calc_profit(rate=row2.close), - row2.Index - row.Index + (row2.date - row.date).seconds // 60 ), row2.date return None @@ -231,5 +231,5 @@ def start(args): }) logger.info( '\n==================================== BACKTESTING REPORT ====================================\n%s', # noqa - generate_text_table(data, results, config['stake_currency'], strategy.ticker_interval) + generate_text_table(data, results, config['stake_currency']) ) diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index 8b89e1985..12c061b4f 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -406,7 +406,7 @@ def optimizer(params): total_profit = results.profit_percent.sum() trade_count = len(results.index) - trade_duration = results.duration.mean() * 5 + trade_duration = results.duration.mean() if trade_count == 0 or trade_duration > MAX_ACCEPTED_TRADE_DURATION: print('.', end='') diff --git a/freqtrade/tests/optimize/test_backtesting.py b/freqtrade/tests/optimize/test_backtesting.py index 0dd4f777a..bf060e374 100644 --- a/freqtrade/tests/optimize/test_backtesting.py +++ b/freqtrade/tests/optimize/test_backtesting.py @@ -29,12 +29,12 @@ def test_generate_text_table(): 'loss': [0, 0] } ) - print(generate_text_table({'BTC_ETH': {}}, results, 'BTC', 5)) - assert generate_text_table({'BTC_ETH': {}}, results, 'BTC', 5) == ( + print(generate_text_table({'BTC_ETH': {}}, results, 'BTC')) + assert generate_text_table({'BTC_ETH': {}}, results, 'BTC') == ( 'pair buy count avg profit % total profit BTC avg duration profit loss\n' # noqa '------- ----------- -------------- ------------------ -------------- -------- ------\n' # noqa - 'BTC_ETH 2 15.00 0.60000000 100.0 2 0\n' # noqa - 'TOTAL 2 15.00 0.60000000 100.0 2 0') # noqa + 'BTC_ETH 2 15.00 0.60000000 20.0 2 0\n' # noqa + 'TOTAL 2 15.00 0.60000000 20.0 2 0') # noqa def test_get_timeframe(default_strategy):