feat(gui): Phase B — Equity + History pages

Adds the analytics surface of the dashboard:

* gui/data_layer.py — extended with load_closed_positions (windowed
  filter on closed_at) and three pure-function aggregators:
  compute_equity_curve, compute_kpis, compute_monthly_stats. Drawdown
  is measured against the running peak of cumulative realised P&L.
* gui/pages/3_📈_Equity.py — KPI strip, plotly cumulative-PnL line,
  drawdown area below, P&L histogram by close_reason, per-month table
  with win-rate.
* gui/pages/4_📜_History.py — windowed table of closed trades with
  multiselect close-reason and winners/losers radio filters, six-tile
  KPI strip, CSV export button.
* pyproject.toml — relax mypy on plotly + pandas (no shipped stubs).

Validated with synthetic data: 3 trades, 67% win rate, $50 total,
max drawdown $30 — all matching expected math. GUI launches, HTTP 200
on / and /_stcore/health.

353/353 tests still pass; ruff clean; mypy strict src clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 12:11:02 +02:00
parent 1af983aff1
commit db888ce0e8
4 changed files with 491 additions and 1 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ no_implicit_reexport = true
files = ["src/cerbero_bite"]
[[tool.mypy.overrides]]
module = ["apscheduler.*"]
module = ["apscheduler.*", "plotly.*", "pandas.*"]
ignore_missing_imports = true
[tool.pytest.ini_options]