feat: PnL attribution (crate + /pnl API + page + CLI) (#6)
* feat(product): pnl-attribution crate + GET /pnl + dashboard page
Average-cost realized/unrealized PnL attribution from a fill stream — core
trading-product functionality.
- crates/pnl-attribution: per-symbol position/avg-cost, realized PnL on sells,
unrealized from marks, fees; portfolio totals. 5 tests + doctest.
- GET /pnl?fills=SYM,buy,qty,price[,fee];…&marks=SYM:price — runs the real
attributor (2 parse tests).
- /pnl dashboard page renders per-symbol + total PnL.
- Registered in workspace; build green, clippy clean, tsc clean.
- Counts: 27 crates, 74 routes, 72 pages; docs synced.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(cli): pnl subcommand (completes the quant CLI suite)
guardrail-cli gains 'pnl --fills … --marks …' driving pnl-attribution directly.
Verified: CAKE buy10@2/sell4@3, mark 3 -> realized 4, unrealized 6, total 10.
All five quant crates now have a CLI subcommand. CLI subcommands -> 45.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>