Add web dashboard, historical data loader, and backtest reporting

- Add Flask dashboard with status, config editor, logs, kill switch,
  and backtest results pages with monthly P&L breakdowns
- Add historical_loader.py for paginated OANDA candle fetching (1yr+)
- Update backtester to $100k starting equity, monthly P&L computation,
  and JSON summary output for dashboard display
- Update config to EUR_USD only on M5/M15 with SMA 21/50 strategy
- Add backtest.html template with performance metrics and bar charts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Brent Neale
2026-02-17 13:29:12 +10:00
co-authored by Claude Opus 4.6
parent ef950f25dd
commit 212f581d01
15 changed files with 1359 additions and 42 deletions
+113
View File
@@ -0,0 +1,113 @@
{
"instrument": "EUR_USD",
"granularity": "M15",
"run_time": "2026-02-17T03:21:00.971644+00:00",
"data_range": {
"start": "2025-02-17 15:30:00+00:00",
"end": "2026-02-17 03:15:00+00:00",
"bars": 24816
},
"metrics": {
"starting_equity": 100000.0,
"total_return_pct": 0.0729,
"max_drawdown_pct": 0.138,
"num_trades": 590,
"round_trips": 295,
"win_rate_pct": 33.22,
"sharpe_ratio": 1.965,
"final_equity": 100072.93
},
"monthly_pnl": [
{
"month": "2025-02",
"start_equity": 100000.0,
"end_equity": 99975.28,
"pnl": -24.72,
"pnl_pct": -0.0247
},
{
"month": "2025-03",
"start_equity": 99975.28,
"end_equity": 100010.04,
"pnl": 34.75,
"pnl_pct": 0.0348
},
{
"month": "2025-04",
"start_equity": 100010.04,
"end_equity": 100114.13,
"pnl": 104.09,
"pnl_pct": 0.1041
},
{
"month": "2025-05",
"start_equity": 100114.13,
"end_equity": 100147.54,
"pnl": 33.41,
"pnl_pct": 0.0334
},
{
"month": "2025-06",
"start_equity": 100147.54,
"end_equity": 100141.15,
"pnl": -6.38,
"pnl_pct": -0.0064
},
{
"month": "2025-07",
"start_equity": 100141.15,
"end_equity": 100108.29,
"pnl": -32.86,
"pnl_pct": -0.0328
},
{
"month": "2025-08",
"start_equity": 100108.29,
"end_equity": 100121.7,
"pnl": 13.41,
"pnl_pct": 0.0134
},
{
"month": "2025-09",
"start_equity": 100121.7,
"end_equity": 100121.11,
"pnl": -0.59,
"pnl_pct": -0.0006
},
{
"month": "2025-10",
"start_equity": 100121.11,
"end_equity": 100077.51,
"pnl": -43.6,
"pnl_pct": -0.0435
},
{
"month": "2025-11",
"start_equity": 100077.51,
"end_equity": 100068.99,
"pnl": -8.52,
"pnl_pct": -0.0085
},
{
"month": "2025-12",
"start_equity": 100068.99,
"end_equity": 100072.84,
"pnl": 3.85,
"pnl_pct": 0.0039
},
{
"month": "2026-01",
"start_equity": 100072.84,
"end_equity": 100084.84,
"pnl": 12.0,
"pnl_pct": 0.012
},
{
"month": "2026-02",
"start_equity": 100084.84,
"end_equity": 100072.93,
"pnl": -11.92,
"pnl_pct": -0.0119
}
]
}
+113
View File
@@ -0,0 +1,113 @@
{
"instrument": "EUR_USD",
"granularity": "M5",
"run_time": "2026-02-17T03:20:15.063316+00:00",
"data_range": {
"start": "2025-02-17 07:15:00+00:00",
"end": "2026-02-17 03:10:00+00:00",
"bars": 74536
},
"metrics": {
"starting_equity": 100000.0,
"total_return_pct": 0.0653,
"max_drawdown_pct": 0.1037,
"num_trades": 1684,
"round_trips": 842,
"win_rate_pct": 35.99,
"sharpe_ratio": 1.0001,
"final_equity": 100065.29
},
"monthly_pnl": [
{
"month": "2025-02",
"start_equity": 100000.0,
"end_equity": 99990.93,
"pnl": -9.07,
"pnl_pct": -0.0091
},
{
"month": "2025-03",
"start_equity": 99990.93,
"end_equity": 100043.93,
"pnl": 53.0,
"pnl_pct": 0.053
},
{
"month": "2025-04",
"start_equity": 100043.93,
"end_equity": 100065.95,
"pnl": 22.02,
"pnl_pct": 0.022
},
{
"month": "2025-05",
"start_equity": 100065.95,
"end_equity": 100122.9,
"pnl": 56.95,
"pnl_pct": 0.0569
},
{
"month": "2025-06",
"start_equity": 100122.9,
"end_equity": 100129.99,
"pnl": 7.09,
"pnl_pct": 0.0071
},
{
"month": "2025-07",
"start_equity": 100129.99,
"end_equity": 100070.84,
"pnl": -59.15,
"pnl_pct": -0.0591
},
{
"month": "2025-08",
"start_equity": 100070.84,
"end_equity": 100136.88,
"pnl": 66.04,
"pnl_pct": 0.066
},
{
"month": "2025-09",
"start_equity": 100136.88,
"end_equity": 100128.96,
"pnl": -7.92,
"pnl_pct": -0.0079
},
{
"month": "2025-10",
"start_equity": 100128.96,
"end_equity": 100114.83,
"pnl": -14.13,
"pnl_pct": -0.0141
},
{
"month": "2025-11",
"start_equity": 100114.83,
"end_equity": 100087.25,
"pnl": -27.58,
"pnl_pct": -0.0275
},
{
"month": "2025-12",
"start_equity": 100087.25,
"end_equity": 100088.28,
"pnl": 1.03,
"pnl_pct": 0.001
},
{
"month": "2026-01",
"start_equity": 100088.28,
"end_equity": 100092.01,
"pnl": 3.73,
"pnl_pct": 0.0037
},
{
"month": "2026-02",
"start_equity": 100092.01,
"end_equity": 100065.29,
"pnl": -26.72,
"pnl_pct": -0.0267
}
]
}