Add profit to backtest summary output

This commit is contained in:
Matthias 2020-08-18 16:59:24 +02:00
parent 668d167adc
commit 9982ad2f36
2 changed files with 5 additions and 0 deletions

View File

@ -165,6 +165,7 @@ A backtesting result will look like that:
| Total trades | 429 |
| First trade | 2019-01-01 18:30:00 |
| First trade Pair | EOS/USDT |
| Total Profit % | 152.41% |
| Trades per day | 3.575 |
| Best day | 25.27% |
| Worst day | -30.67% |

View File

@ -249,6 +249,9 @@ def generate_backtest_stats(config: Dict, btdata: Dict[str, DataFrame],
'sell_reason_summary': sell_reason_stats,
'left_open_trades': left_open_results,
'total_trades': len(results),
'profit_mean': results['profit_percent'].mean(),
'profit_total': results['profit_percent'].sum(),
'profit_total_abs': results['profit_abs'].sum(),
'backtest_start': min_date.datetime,
'backtest_start_ts': min_date.timestamp * 1000,
'backtest_end': max_date.datetime,
@ -372,6 +375,7 @@ def text_table_add_metrics(strat_results: Dict) -> str:
('Total trades', strat_results['total_trades']),
('First trade', min_trade['open_date'].strftime(DATETIME_PRINT_FORMAT)),
('First trade Pair', min_trade['pair']),
('Total Profit %', f"{round(strat_results['profit_total'] * 100, 2)}%"),
('Trades per day', strat_results['trades_per_day']),
('Best day', f"{round(strat_results['backtest_best_day'] * 100, 2)}%"),
('Worst day', f"{round(strat_results['backtest_worst_day'] * 100, 2)}%"),