Skip to content

Commit

Permalink
Updated Strategy Summary table to match other backtesting tables (#2864)
Browse files Browse the repository at this point in the history
  • Loading branch information
yazeed committed Feb 6, 2020
1 parent 9639ffb commit 5b00eaa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/backtesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion freqtrade/optimize/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def start(self) -> None:
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))
Expand Down
6 changes: 3 additions & 3 deletions freqtrade/optimize/optimize_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions tests/optimize/test_optimize_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5b00eaa

Please sign in to comment.