position-tracker/src
Manohar dca5fea679 feat: add Analysis tab with position intelligence engine
Phase 1 of the position-tracker → analysis port:

Backend:
- src/ai/types.ts       — shared types (AnalysisInput, ClassifiedPosition, AnalysisResult, etc.)
- src/ai/greeks.ts      — added calcTheoreticalPrice() export for scenario analysis
- src/ai/classifier.ts  — pure-function position classifier (DEAD_WEIGHT/WORKING/UNDER_PRESSURE/HEDGE/DANGER_SHORT) with module-level hysteresis Map
- src/ai/portfolio-greeks.ts — aggregates per-unit Greeks × quantity into portfolio totals
- src/ai/risk-assessor.ts   — naked short detection, concentration, side imbalance, Greeks breach checks
- src/ai/scenario.ts        — P&L grid at ±100..±1000 spot moves per underlying
- src/ai/analyze.ts         — orchestrator: maps Position[] → AnalysisInput[], reads spot from market_cache, stores JSON in analysis_snapshots
- src/db/client.ts      — analysis_snapshots table + index
- src/tracker/poll.ts   — runAnalysis() called after every pollTick + forcePoll
- src/api/server.ts     — GET /api/analysis endpoint

Frontend (public/index.html):
- Multi-page nav with Dashboard | Analysis tabs (showView())
- Analysis view: summary cards (delta/theta/vega/risk level), action list (urgent positions sorted by urgency score), classification table with urgency bars, risk assessment details, scenario P&L grid per underlying
- loadAnalysis() + renderAnalysis() wired to tab switch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 14:07:24 +05:30
..
ai feat: add Analysis tab with position intelligence engine 2026-06-19 14:07:24 +05:30
angel fix: restore LABELS const 2026-05-15 04:20:30 +00:00
api feat: add Analysis tab with position intelligence engine 2026-06-19 14:07:24 +05:30
db feat: add Analysis tab with position intelligence engine 2026-06-19 14:07:24 +05:30
notify feat: initial position tracker scaffold 2026-05-08 11:22:05 +00:00
tracker feat: add Analysis tab with position intelligence engine 2026-06-19 14:07:24 +05:30
index.ts fix: add sendPortfolioDigest to import 2026-05-12 05:50:20 +00:00