From 301f8a201d2cc1fc19374d49e3a9d895ba0c4782 Mon Sep 17 00:00:00 2001 From: Yazeed Al Oyoun Date: Wed, 5 Feb 2020 01:36:15 +0100 Subject: [PATCH] Updated Strategy Summary table to match other backtesting tables --- docs/backtesting.md | 4 ++-- freqtrade/optimize/backtesting.py | 2 +- freqtrade/optimize/optimize_reports.py | 6 +++--- tests/optimize/test_optimize_reports.py | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/backtesting.md b/docs/backtesting.md index 41428085d..2abb32ca0 100644 --- a/docs/backtesting.md +++ b/docs/backtesting.md @@ -237,8 +237,8 @@ There will be an additional table comparing win/losses of the different strategi Detailed output for all strategies one after the other will be available, so make sure to scroll up to see the details per strategy. ``` -=========================================================== Strategy Summary =========================================================== -| Strategy | buy count | avg profit % | cum profit % | tot profit BTC | tot profit % | avg duration | profit | loss | +=========================================================== STRATEGY SUMMARY =========================================================== +| Strategy | Buy Count | Avg Profit % | Cum Profit % | Tot Profit BTC | Tot Profit % | Avg Duration | Wins | Losses | |:------------|------------:|---------------:|---------------:|-----------------:|---------------:|:---------------|---------:|-------:| | Strategy1 | 429 | 0.36 | 152.41 | 0.00762792 | 76.20 | 4:12:00 | 186 | 243 | | Strategy2 | 1487 | -0.13 | -197.58 | -0.00988917 | -98.79 | 4:43:00 | 662 | 825 | diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 96978d407..13c8990a5 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -441,7 +441,7 @@ class Backtesting: print() if len(all_results) > 1: # Print Strategy summary table - print(' Strategy Summary '.center(133, '=')) + print(' STRATEGY SUMMARY '.center(133, '=')) print(generate_text_table_strategy(self.config['stake_currency'], self.config['max_open_trades'], all_results=all_results)) diff --git a/freqtrade/optimize/optimize_reports.py b/freqtrade/optimize/optimize_reports.py index c5cd944a1..8ad063056 100644 --- a/freqtrade/optimize/optimize_reports.py +++ b/freqtrade/optimize/optimize_reports.py @@ -121,9 +121,9 @@ def generate_text_table_strategy(stake_currency: str, max_open_trades: str, floatfmt = ('s', 'd', '.2f', '.2f', '.8f', '.2f', 'd', '.1f', '.1f') tabular_data = [] - headers = ['Strategy', 'buy count', 'avg profit %', 'cum profit %', - f'tot profit {stake_currency}', 'tot profit %', 'avg duration', - 'profit', 'loss'] + headers = ['Strategy', 'Buy Count', 'Avg Profit %', 'Cum Profit %', + f'Tot Profit {stake_currency}', 'Tot Profit %', 'Avg Duration', + 'Wins', 'Losses'] for strategy, results in all_results.items(): tabular_data.append([ strategy, diff --git a/tests/optimize/test_optimize_reports.py b/tests/optimize/test_optimize_reports.py index 8c1a3619d..3ea13be47 100644 --- a/tests/optimize/test_optimize_reports.py +++ b/tests/optimize/test_optimize_reports.py @@ -91,14 +91,14 @@ def test_generate_text_table_strategy(default_conf, mocker): ) result_str = ( - '| Strategy | buy count | avg profit % | cum profit % ' - '| tot profit BTC | tot profit % | avg duration | profit | loss |\n' - '|:-----------|------------:|---------------:|---------------:' - '|-----------------:|---------------:|:---------------|---------:|-------:|\n' + '| Strategy | Buy Count | Avg Profit % | Cum Profit % | Tot Profit BTC ' + '| Tot Profit % | Avg Duration | Wins | Losses |\n' + '|:-----------|------------:|---------------:|---------------:|-----------------:' + '|---------------:|:---------------|-------:|---------:|\n' '| ETH/BTC | 3 | 20.00 | 60.00 ' - '| 1.10000000 | 30.00 | 0:17:00 | 3 | 0 |\n' + '| 1.10000000 | 30.00 | 0:17:00 | 3 | 0 |\n' '| LTC/BTC | 3 | 30.00 | 90.00 ' - '| 1.30000000 | 45.00 | 0:20:00 | 3 | 0 |' + '| 1.30000000 | 45.00 | 0:20:00 | 3 | 0 |' ) assert generate_text_table_strategy('BTC', 2, all_results=results) == result_str