# Non-Functional Delta: 008 Pricing Awareness and Market Data

> For the complete documentation index, see [llms.txt](https://deploy-preview-472--lucky-concha-f3599f.netlify.app/llms.txt).

Parent state: `007-observability-lgtm-compose`

## Runtime / Operations

*   Add `price-publisher` service to compose runtime with deterministic startup behavior.
*   Preserve single ingress model and NATS websocket entrypoint from state `006`.
*   Keep market bootstrap mode configurable (`snapshot` or `yfinance`) without code change.
*   Keep publish cadence and batch ratio configurable via runtime environment:
    *   `PRICE_PUBLISH_INTERVAL_MIN_MS`,
    *   `PRICE_PUBLISH_INTERVAL_MAX_MS`,
    *   `PRICE_PUBLISH_BATCH_RATIO`.
*   Keep supported symbol universe configurable and shared across pricing + reference-data:
    *   `SUPPORTED_TICKERS`,
    *   `REFERENCE_DATA_SUPPORTED_TICKERS` (wired from shared set in compose).

## Precision / Data Quality

*   Persisted trade execution price and position average cost basis use precision scale of 3.
*   Position valuation calculations in UI use numeric safety defaults when market prices are temporarily unavailable.
*   Snapshot and stream pricing payloads must include server-assigned UTC event timestamp (`asOf`) so clients can compare freshness deterministically.

## Performance / Scalability

*   Price stream fan-out uses NATS subject wildcard (`pricing.*`) for efficient browser subscription.
*   Price generation cadence uses randomized interval (default `750-1500ms`) with subset publish model (default `25%` symbols each cycle) to reduce local message flood.
*   Price bootstrap for grid-style UI should use one-call multi-symbol snapshot retrieval where possible, instead of per-row HTTP fanout.

## Reliability

*   yfinance bootstrap is startup-only and falls back to snapshot/fallback values on failure.
*   Existing baseline trade/account validation behavior remains unchanged.
*   Legacy ticker compatibility is normalized at source (`FB` emitted as `META`) to avoid dual-symbol drift across clients.
*   Prometheus scraping coverage from state `007` remains required for any service in this state that exposes Prometheus-compatible metrics.
