Skip to main content

Architecture (State 008 Pricing Awareness and Market Data)

State 008 builds on NATS-based runtime from 006 and adds synthetic market pricing, trade execution price stamping, position cost basis aggregation, and frontend valuation.

  • Inherits architectural baseline from: 007-observability-lgtm-compose
  • Generated from: system/architecture.model.json
  • Canonical flows: ../001-baseline-uncontainerized-parity/system/end-to-end-flows.md

Entry Points​

  • ingress: http://localhost:8080
  • nats-ws: ws://localhost:8080/nats-ws
  • price-publisher: http://localhost:18100/prices

Architecture Diagram​

Diagram source
flowchart LR
  trader["Trader Browser"]
  ingress["NGINX Ingress"]
  web["Web Front End Angular"]
  nats["NATS Broker"]
  pricePublisher["Price Publisher"]
  tradeService["Trade Service"]
  tradeProcessor["Trade Processor"]
  account["Account Service"]
  position["Position Service"]
  referenceData["Reference Data"]
  people["People Service"]
  database["Database"]
  trader -->|"Single browser entrypoint"| ingress
  ingress -->|"/"| web
  ingress -->|"/price-publisher"| pricePublisher
  ingress -->|"/nats-ws (WS upgrade)"| nats
  tradeService -->|"Validate ticker"| referenceData
  tradeService -->|"Validate account"| account
  tradeService -->|"Fetch execution price"| pricePublisher
  tradeService -->|"Publish /trades"| nats
  tradeProcessor -->|"Consume /trades, publish account updates"| nats
  pricePublisher -->|"Publish pricing.<TICKER>"| nats
  web -->|"Subscribe account + pricing topics"| nats
  tradeProcessor -->|"Persist trades + positions"| database
  position -->|"Query trades + positions"| database
  account -->|"Validate person"| people

Node Catalog​

NodeKindLabelNotes
traderactorTrader BrowserUses Angular UI and receives realtime trade, position, and pricing updates.
ingressgatewayNGINX IngressRoutes REST and websocket traffic.
webfrontendWeb Front End AngularSubscribes to account and pricing streams via nats.ws.
natsmessagingNATS BrokerPub/sub broker for backend and browser streaming.
pricePublisherservicePrice PublisherPublishes pricing.<TICKER> and exposes REST quote endpoint.
tradeServiceserviceTrade ServiceValidates account/ticker and stamps execution price before publishing orders.
tradeProcessorserviceTrade ProcessorProcesses trades, persists price/cost basis, emits account updates.
accountserviceAccount ServiceAccount and account-user operations.
positionservicePosition ServiceTrades/positions query endpoints.
referenceDataserviceReference DataTicker lookup/list.
peopleservicePeople ServiceIdentity lookup and validation.
databasedatabaseDatabasePersistent account/trade/position state.

State Notes​

  • Markets are treated as always open in this simulation.
  • yfinance bootstrap is optional startup-only and falls back to snapshot data.
  • Advanced pricing/risk engines are intentionally out of scope for this state.