Some checks failed
- Add Portfolio + Position models (Prisma + migrations) - Backend: PortfolioModule with CRUD, enrichment, type detection - Backend: enrichBondPosition returns 13 financial fields (YTM, duration, coupon, NCD, accrued interest, bid/offer, bondType, offerDate, etc.) - Frontend: portfolio pages, 4 TanStack Query hooks, split share/bond tables - Fix: MOEX bond marketdata board fallback (TQCB → TQOB for OFZ) - Frontend: clickable ticker links to /stocks/:secid and /bonds/:secid - Remove: target allocation, deviation, tags display from Phase 1 - Docs: ADR-009 (domain model), ADR-010 (price computation), portfolio backend doc, superpowers spec + plan
876 B
876 B
ADR-010: Backend Price Computation
Status: Accepted
Date: 2026-06-14
Context
Portfolio positions need current market prices for value calculation. Where should price computation happen — on backend or frontend?
Decision
Compute prices on backend. GET /api/v1/portfolios/:id returns fully computed PortfolioDetailResponseDto with currentPrice, currentValue, weightPercent, and deviation for each position.
Rationale
- Single source of truth for financial calculations
- Frontend receives ready-to-display data
- Backend caching reduces MOEX API calls
- Avoids N individual price requests from frontend
Consequences
- Backend makes N MOEX requests per portfolio read (cached by TTL 900s)
- Portfolio endpoint cannot use naive response caching (prices per-user)
- Extra load on backend when many users view portfolios simultaneously