| name | report-generation |
| description | Generates structured trading performance reports. Includes performance metrics summary, equity curve, trade-by-trade log, monthly returns heatmap, and comparative benchmark analysis. Trigger when the user wants a summary or report of trading results. |
| metadata | {"hermes":{"tags":["report","performance","trading","metrics","summary"],"category":"analysis"}} |
Report Generation
Generates comprehensive trading performance reports.
Real Code Reference
tradinglearn/backtest/backtester.py — generate_report() (summary) and generate_detailed_report() (full metrics)
tradinglearn/utils/parameter_optimizer.py — save_optimization_results() → CSV with all param combos
tradinglearn/reports/ — output directory for generated reports
Report Sections
- Executive Summary — total return, Sharpe, max drawdown, win rate, CAGR
- Equity Curve — portfolio value time series with key event annotations
- Trade Log — each trade: entry/exit dates, prices, P&L, holding period
- Monthly Returns — calendar heatmap
- Drawdown Analysis — top-5 drawdowns: peak, trough, recovery, duration
- Benchmark Comparison — vs. market index (e.g. 000300 CSI 300)
Output Formats
- Console:
bt.generate_detailed_report() prints formatted text
- CSV: trade log + monthly returns for spreadsheets
- DataFrame:
bt.get_performance() / bt.get_portfolio() / bt.get_signals()
Trade Log Schema
trade_id, symbol, entry_date, exit_date, entry_price, exit_price,
direction, quantity, pnl, pnl_pct, holding_days, exit_reason