Migration Guidance: 006 to 007 Pricing Awareness
Goalβ
Add pricing behavior on top of state 006 messaging/runtime without breaking existing baseline trade/account workflows.
Backend Service Changesβ
trade-serviceβ
- Fetch current price from
price-publisher(GET /prices/{ticker}). - Stamp
tradeOrder.pricebefore publishing on/trades.
trade-processorβ
- Persist
trade.price. - Update and persist
position.averageCostBasisduring position aggregation. - Continue publishing account-scoped events with enriched payloads.
position-serviceβ
- Expose enriched persisted trade/position fields through existing REST endpoints.
price-publisher (new)β
- Bootstrap baseline open/close values from:
- snapshot file (default), or
- yfinance (startup-only mode).
- Emit
pricing.<TICKER>NATS updates on randomized interval (750-1500msdefault), publishing randomized subset per cycle (25%default, configurable). - Align supported symbol universe with reference-data and normalize legacy
FBtoMETAin reference-data output.
Frontend Changesβ
- Keep account-scoped subscriptions from
006. - Add
pricing.*subscription to update market valuation fields in real time. - Display:
- trade execution
price, - relative execution time,
- position
marketPrice, value, and P&L, - portfolio totals for value and cost basis.
- trade execution
Cutover Strategyβ
- Add
price-publisherruntime and pricing subject map. - Enrich trade submission + persistence with execution price.
- Enrich position persistence with average cost basis.
- Extend frontend valuation rendering and totals.
Post-Migrationβ
- Validate baseline flows F2/F4 still pass with pricing additions.
- Keep advanced pricing engines and risk analytics out of scope for this state.