Skip to content

Architecture Overview

Every service, library, storage system, and frontend in the Position Keeping System (PKS), with data-flow bindings. Hot path (< 1 ms), warm path (< 100 ms), and async/cold paths are labeled in the diagram and latency table below.

Frontends & Clients

Storage & Message Bus

Query & Broadcast

Reporting

Back-Office Operations

Valuation

Position Keeping Pipeline

Execution Layer

FIX / TWIME / REST fills

raw FillEvent

TradeBooked · bo.booking.v1

LifecycleEventApplied · bo.booking.v1

TradeBooked (manual) · bo.booking.v1

TradeBooked (bulk) · bo.booking.v1

TradeBooked (child allocation) · bo.booking.v1

LifecycleEventApplied · bo.booking.v1

TradeBooked (accrual) · bo.booking.v1

TradeBooked (transfer) · bo.booking.v1

TradeBooked (venue fills)

decoded fill → routed book

TradeBooked (manual · batch · accrual)

LifecycleEventApplied

lot match request

matched lots + realised P&L

PositionSlot · seqlock write

PositionUpdated · bo.position.updated.v1

checkpoint trigger

position_snapshot row · WAL checkpoint

fill event

INSERT ts row · bo_positions

PositionUpdated

PositionValuated

PnLAttributed · bo.pnl.attributed.v1

TradeBooked

CashLedgerEntry · GL row · bo.cash.ledger.v1

ledger row

CashLedgerEntry

CashBalance · bo.cash.balance.v1

CashBalance

OcpPosition · bo.cash.ocp.v1

PositionUpdated

pd_positions overlay

recon result rows

md:mark:v1:{id} Hash · SET

md.mark.v1.{instrument_id}

mark event

PositionUpdated

gRPC PriceRequest

PriceResponse · PV · Greeks · analytics

PositionValuated · bo.position.valuated.v1

valuation row

TradeBooked

settlement instruction row

SettlementStatusChanged · bo.settlement.v1

TradeBooked

confirmation state row

TradeBooked

CorporateActionBooked · bo.ca.v1

corp action row

PositionUpdated

margin row · collateral row

MarginCall · bo.collateral.v1

PositionValuated

regulatory report row

external statement (CSV · FIX)

match result · break row

ReconciliationResult · bo.recon.v1

* (undeliverable messages)

alert · dead-letter row

cron trigger

dispatch compute tasks

section data

XLSX · PDF · HTML artifacts

Telegram delivery

bo.report.generated.v1

bo.report.edit.v1

bo.report.locked.v1

report rows · section JSONB

PositionUpdated · PositionValuated

Trades · Cash · Reports

Settlement · Orders

live PositionSlot · seqlock read

mark price lookup

position_record · trades · reports

reconciliation · settlement · auth

OHLC bars · pd_positions overlay

gRPC PriceRequest (pre-trade pricing)

md REST query

ILP / HTTP query

mark lookup

events fan-out

WebSocket JSON · positions

trades · blotter · cash · reports

orders · curves · ocp

gRPC stream · PositionViewPatch

REST /api/v1/* (GET · POST · PATCH · DELETE)

gRPC StreamPositions · GetPosition

GetPositionHistory · WatchInstrumentUpdates

direct seqlock read (< 1 µs)

direct seqlock read (< 1 µs)

PositionUpdated · Valuated

(via algo-data-bus)

Venue Gateways

─────────────

MOEX FIX · MOEX TWIME

MOEX ASTS · Binance · OKX

Hyperliquid · Coinbase

Bybit · Alpha4 · Polymarket

IBKR · Exante · CQG

execution-platform

─────────────

OMS · ClOrdId minting

round-robin LB

connection manager

trade-capture-lifecycle

─────────────

trade validation

state machine

regime routing

trade-booker

─────────────

manual booking API

idempotency guard

OTC instrument create

bo-book-router

─────────────

fill decoder

venue → book routing

MOEX · Coinbase

Hyperliquid · Polymarket

bo-allocation

─────────────

block trade

→ child book split

bo-batch-api

─────────────

bulk trade import

CSV / JSON

otc-lifecycle-service

─────────────

confirm · novate

terminate · give-up

cashflow-accrual-engine

─────────────

coupon accrual

perp funding accrual

inter-entity-xfer-engine

─────────────

position transfer

cash transfer

position-accumulator

─────────────

SOLE position writer

per-book single-writer

in-memory state

lot matching dispatch

SHM output

NATS publisher

async PG checkpoint

bo-lotmatch

─────────────

FIFO · LIFO

weighted-average

per-book override

per-class override

position-snapshot-writer

─────────────

async Postgres

checkpoint writer

crash-recovery WAL

questdb-trade-writer

─────────────

time-series writer

bo_positions table

pnl-engine

─────────────

P&L attribution

δ · γ · ν · θ

carry · FX · funding

ledger-service

─────────────

double-entry ledger

GL posting

cash entries

cash-position-service-v2

─────────────

cash balance agg

per (entity·account·ccy)

open-currency-position-service

─────────────

net FX exposure

per entity

position-reconciler

─────────────

cross-source

position reconciliation

md-mark-loader

─────────────

ISS batch-by-board

ALOR REST intraday

Redis + NATS publisher

valuation-hub

─────────────

mark consumption

pricing-engine dispatch

Greeks aggregator

PositionValuated publisher

pricing-engine

─────────────

QuantLib FFI

BSM · curve models

full instrument×model

XVA · bond analytics

settlement-service

─────────────

instruction lifecycle

status tracking

confirmations-service

─────────────

trade confirm

workflow

corp-actions-service

─────────────

dividends · splits

mergers · rights

dispute-service

─────────────

break dispute

workflow

collateral-service

─────────────

margin · collateral

IM / VM tracking

regulatory-reporter

─────────────

regulatory output

SIMM · Basel

reconciliation-service

─────────────

external statement

matching engine

bo-recon

─────────────

internal recon

engine

mavr-dlq-reaper

─────────────

dead-letter queue

consumer · alerter

report-scheduler

─────────

cron trigger

EOD timing

report-engine

─────────

template executor

16-section EOD

report-worker

─────────

distributed

compute worker

report-renderer

─────────

HTML · XLSX · PDF

one-pager

report-distributor

─────────

email · Telegram

delivery

pks-bff

─────────────

Axum REST :8080

gRPC TLS :8443

JWT auth · RBAC

position merge cache

SimulatorService

broadcaster

─────────────

tokio broadcast channel

batch merge · 10 ms window

WS fan-out · heartbeat

md-query-api

─────────────

market data

REST proxy

for BFF

NATS JetStream

─────────────

durable consumers

24 h trade retention

7 d position retention

Postgres

─────────────

back_office schema

trade schema

position schema

auth schema

report schema

QuestDB

─────────────

bo_positions

pd_positions

bo_ohlc

Redis

─────────────

md:mark:v1:{id}

curves

JWT blocklist

session cache

Shared Memory

─────────────

/pks-positions-v1

/pks-greeks-v1

/md-marks-v1

seqlock protocol

atlas-web

─────────────

React 18 · Vite

AG Grid · Zustand

TanStack Query

Atlas Qt

─────────────

C++ Qt6 desktop

SHM hot path

gRPC stream

algo strategies

─────────────

via algo-data-bus

SHM direct read


PathTransportTypical latencyDescription
Fill → SHM position slotIn-process + SHM seqlock< 1 msFill lands in position-accumulator, lot-matched, written to /pks-positions-v1
SHM → Atlas Qt / algo strategySHM seqlock read< 1 µsDirect shared-memory read; no network hop
Fill → WebSocket (atlas-web)NATS + BFF + WS5–15 msPositionUpdated via NATS → broadcaster → WebSocket push
Mark → valuation resultNATS + gRPC + NATS50–200 msMark event → valuation-hub → pricing-engine gRPC → PositionValuated → BFF
Trade → Postgres checkpointAsync write< 500 msposition-snapshot-writer async flush; not on the hot path
Fill → QuestDB time-seriesAsync write< 1 squestdb-trade-writer async INSERT
EOD snapshotBatch job~2–5 minbo-eod-aggregate triggered by report-scheduler

ComponentCrateDescriptionConsumesPublishesStorage R/W
execution-platformexecution-platform (execution repo)OMS: ClOrdId minting, round-robin load-balanced connection manager, 18 venue gateways (MOEX FIX/TWIME/ASTS, crypto CLOBs, IBKR, Exante, CQG, Polymarket)Venue fills (FIX/TWIME/REST)FillEventpd.canonicalPostgres (execution schema)
trade-capture-lifecycletrade-capture-lifecycleTrade validation state machine; regime routing; lifecycle event processor (amend, cancel, novation, give-up, interbook)FillEvent (pd.canonical)TradeBooked · bo.booking.v1 · LifecycleEventApplied · bo.booking.v1Postgres (trade schema)
trade-bookertrade-bookerManual booking REST API; idempotency guard (24 h deduplication by idempotency_hash); OTC instrument registrationREST POST /trades/bookTradeBooked · bo.booking.v1Postgres (back_office)
bo-book-routerbo-book-routerVenue fill decoder; routes decoded fills to the correct book based on routing rules; venue decoders: MOEX FIX, MOEX TWIME, Coinbase, Hyperliquid, Alpha4, PolymarketNATS TradeBookedDecoded fill → position-accumulator (direct call)
bo-allocationbo-allocationSplits a block trade into child allocations across books per allocation instructionsNATS TradeBooked (block)TradeBooked · bo.booking.v1 (child legs)Postgres (back_office.allocation)
bo-batch-apibo-batch-apiBulk trade import: accepts CSV or JSON batch; validates; publishes individual TradeBooked eventsREST POST /batch/tradesTradeBooked · bo.booking.v1 (per row)Postgres (batch audit)
position-accumulatorposition-accumulatorSole writer of position state. Per-book single-writer; in-memory position map; FIFO/LIFO/WA lot matching via bo-lotmatch; seqlock SHM write; NATS publisher; crash-idempotent (dedup by trade_id)NATS TradeBooked · LifecycleEventApplied (via bo-book-router)PositionUpdated · bo.position.updated.v1 → NATS; PositionSlot → SHM /pks-positions-v1; checkpoint trigger → position-snapshot-writerSHM write; Postgres (via PSW)
bo-lotmatchbo-lotmatchLot matching algorithm library: FIFO (default), LIFO, weighted-average; configurable per book and per instrument class; computes realised P&L at closeCalled by position-accumulatorReturns matched lots + realised P&L to caller— (stateless library)
position-snapshot-writerposition-snapshot-writerAsync Postgres checkpoint writer; receives checkpoint triggers from position-accumulator; writes back_office.position_snapshot (crash-recovery WAL)Checkpoint trigger from PAposition_snapshot rows → PostgresPostgres W
questdb-trade-writerquestdb-trade-writerConsumes TradeBooked events; writes time-series rows to QuestDB bo_positions table for historical position queriesNATS TradeBookedQuestDB bo_positions ILP rowsQuestDB W
pnl-enginepnl-engineP&L attribution by Greek bucket: Δ P&L, Γ P&L, ν P&L, θ P&L, carry P&L, FX P&L, funding P&L; writes §11 attribution columns to position_recordNATS PositionUpdated · PositionValuatedPnLAttributed · bo.pnl.attributed.v1 → NATS; attribution rows → PostgresPostgres W
ledger-serviceledger-serviceDouble-entry cash ledger; GL posting on every trade; generates cash entries for settlement, fees, accrualsNATS TradeBooked · LifecycleEventAppliedCashLedgerEntry · bo.cash.ledger.v1 → NATS; ledger rows → PostgresPostgres R/W
cash-position-service-v2cash-position-service-v2Aggregates cash balances per (entity, account, currency) from ledger events; publishes real-time balance updatesNATS CashLedgerEntryCashBalance · bo.cash.balance.v1 → NATSPostgres R/W
open-currency-position-serviceocp-serviceAggregates net FX exposure per entity from cash balances; identifies open currency riskNATS CashBalanceOcpPosition · bo.cash.ocp.v1 → NATSPostgres R/W
cashflow-accrual-enginecashflow-accrual-engineCoupon accrual booking for fixed income; perpetual funding accrual booking at funding intervals; posts paired FUNDING / COUPON tradesNATS bo.mark.v1.* (funding rate marks) · scheduleTradeBooked (accrual) · bo.booking.v1 → NATSPostgres R/W
otc-lifecycle-serviceotc-lifecycle-serviceOTC trade lifecycle: trade confirmation, novation, termination, give-up; generates LifecycleEventApplied eventsREST (from back-office UI) · NATS TradeBookedLifecycleEventApplied · bo.booking.v1 → NATSPostgres R/W
inter-entity-xfer-enginexfer-engineInter-entity position and cash transfer workflows; generates paired give-up / receive trades across legal entitiesREST · internal triggerTradeBooked (transfer) · bo.booking.v1 → NATSPostgres R/W
md-mark-loadermd-mark-loaderLoads end-of-day marks from ISS (batch by board) and intraday marks from ALOR (REST polling); writes to Redis and publishes NATS mark eventsISS REST · ALOR RESTmd:mark:v1:{instrument_id} Hash → Redis; md.mark.v1.{instrument_id} → NATSRedis W
valuation-hubvaluation-hubConsumes mark events; identifies positions needing revaluation; dispatches PriceRequest to pricing-engine via gRPC; receives PriceResponse; publishes PositionValuated; triggers Greeks aggregatorNATS md.mark.v1.* · bo.position.updated.v1PositionValuated · bo.position.valuated.v1 → NATS; valuation rows → PostgresPostgres W; Redis R
pricing-enginepricing-engine (pricing repo)QuantLib C++ FFI; full instrument × model matrix: BSM, Black-76, futures fair value, bond curve, swap NPV, XVA; full Greeks suite; SIMD BSM optimisationgRPC PriceRequest from valuation-hub / pks-bffgRPC PriceResponse (PV · Greeks · analytics)Redis R (curves)
position-reconcilerposition-reconcilerCross-source position reconciliation: compares position-accumulator state against pd_positions (exchange-authoritative) from QuestDB; identifies breaksNATS PositionUpdated · QuestDB pd_positionsRecon result rows → PostgresPostgres W; QuestDB R
settlement-servicesettlement-serviceSettlement instruction lifecycle; tracks pending, confirmed, settled, failed status; manages custodian referencesNATS TradeBookedSettlementStatusChanged · bo.settlement.v1 → NATS; instruction rows → PostgresPostgres R/W
confirmations-serviceconfirmations-serviceTrade confirmation workflow; matches internal trade against counterparty confirm; tracks AFFIRMED / DISPUTED statusNATS TradeBookedConfirmation state rows → PostgresPostgres R/W
corp-actions-servicecorp-actions-serviceCorporate actions processing: dividends, stock splits, mergers, rights issues; adjusts positions via synthetic tradesNATS TradeBooked · external CA feedCorporateActionBooked · bo.ca.v1 → NATS; CA rows → PostgresPostgres R/W
dispute-servicedispute-serviceReconciliation break dispute workflow; manages dispute lifecycle, evidence, resolutionNATS bo.recon.v1Dispute rows → PostgresPostgres R/W
collateral-servicecollateral-serviceInitial and variation margin tracking; collateral valuation; haircut computation; margin call generationNATS PositionUpdated · PositionValuatedMarginCall · bo.collateral.v1 → NATS; margin rows → PostgresPostgres R/W
regulatory-reporterregulatory-reporterGenerates regulatory reports (SIMM, Basel trading book metrics, exposure calculations); writes to Postgres regulatory tablesNATS PositionValuatedRegulatory rows → PostgresPostgres R/W
reconciliation-servicereconciliation-serviceExternal statement ingestion and matching; accepts custodian / broker / exchange position statements; produces match / break resultsExternal statements (CSV, FIX, SWIFT)Match results → bo-recon; break rows → Postgres; ReconciliationResult · bo.recon.v1 → NATSPostgres R/W
bo-reconbo-reconInternal reconciliation engine; receives break data from reconciliation-service; runs matching algorithms; drives dispute workflowNATS bo.recon.v1 · reconciliation-serviceBreak rows → Postgres; bo.recon.v1Postgres R/W
bo-eod-aggregatebo-eod-aggregateEOD position snapshot aggregation; reads intraday position state; writes full position_record v3 rows for the business datePostgres (intraday state) · QuestDBposition_record EOD rows → PostgresPostgres R/W; QuestDB R
report-schedulerreport-schedulerCron-based report trigger; fires EOD report generation at configured time per desk/entity; supports manual triggerSystem clock · REST (manual trigger)Trigger → report-enginePostgres R
report-enginereport-engine (worker)Executes 16-section EOD report templates; distributes work to report-worker pool; assembles results; publishes completion eventreport-scheduler trigger · Postgres position_record · NATS eventsWork tasks → report-worker; section data → report-renderer; bo.report.generated.v1 → NATS; report rows → PostgresPostgres R/W
report-workerreport-workerDistributed report computation worker; processes individual report sections (P&L, Greeks, settlement, regulatory); scales horizontallyTask queue from report-engineSection results → report-enginePostgres R; QuestDB R
report-rendererreport-renderer (lib)Renders report sections to HTML, XLSX (multi-tab), and PDF (one-pager); applies formatting templates and audit trailSection data from report-engineXLSX · PDF · HTML artifacts → report-distributor— (stateless)
report-distributorreport-distributorEmail and Telegram delivery of generated reports; manages distribution lists; tracks delivery receiptsReport artifacts from report-renderer · NATS bo.report.generated.v1Email · Telegram delivery; delivery rows → PostgresPostgres R/W
mavr-dlq-reapermavr-dlq-reaperDead-letter queue consumer; monitors all NATS DLQ subjects for undeliverable messages; alerts on failure; writes dead-letter rows for auditNATS *.dlq.* (all dead-letter subjects)Alert (Telegram / PagerDuty); dead-letter rows → PostgresPostgres W
pks-bffpks-bffPrimary API gateway. Axum REST (:8080) + gRPC TLS (:8443); JWT auth with RS256; per-user RBAC book filtering; in-memory position merge cache (SimulatorService); serves REST snapshot from merge cache or Postgres; proxies pricing requests to pricing-engine; drives broadcasterNATS (all position, trade, cash, report subjects) · SHM /pks-positions-v1 · Redis (marks) · Postgres (all schemas) · QuestDB (OHLC, pd_positions)REST responses → atlas-web; gRPC PositionViewPatch stream → Atlas Qt; events → broadcasterPostgres R; Redis R; QuestDB R; SHM R
broadcaster(module inside pks-bff)tokio::sync::broadcast channel; batches NATS events in ~10 ms windows; fan-out JSON BroadcastMessage to all WebSocket clients; sends heartbeats every 10 s; drops slow consumersEvents from BFF NATS consumerWebSocket JSON → atlas-web (positions · trades · blotter · cash · reports · orders · curves · ocp · payment_orders)
md-query-apimd-query-apiMarket data REST query proxy for BFF; exposes OHLC and mark endpoints; queries QuestDB and Redis on behalf of BFFREST from pks-bffOHLC bars · mark prices → pks-bffQuestDB R; Redis R

ComponentTypeDescriptionWritersReadersKey namespaces / tables
NATS JetStreamMessage busDurable pub/sub with replay; JetStream streams per subject group; 24 h retention for trade events; 7 d for position snapshots; DLQ subjects for each streamAll service publishersAll service consumers; pks-bff broadcasterSee §4 NATS subject taxonomy
PostgresRDBMSPrimary persistent store; five logical schemas on one clusterposition-snapshot-writer, ledger-service, valuation-hub, pnl-engine, settlement-service, report-engine, trade-booker, all ops servicespks-bff, report-engine, bo-eod-aggregate, all ops servicesback_office.* · trade.* · position.* · auth.* · report.*
QuestDBTime-series DBHigh-throughput time-series store for position and OHLC data; ILP ingestion; SQL query interfacequestdb-trade-writer, market-data-processorpks-bff (OHLC), position-reconciler (pd_positions overlay), bo-eod-aggregate, md-query-apibo_positions · pd_positions · bo_ohlc
RedisCache / KV storeMark cache, curve store, JWT blocklist, session cache; key-TTL evictionmd-mark-loader (marks), pks-bff (JWT blocklist writes)pks-bff, valuation-hub, pricing-engine, md-query-apimd:mark:v1:{id} · curve:{id} · jwt:blocklist:{jti}
Shared Memory (SHM)IPCPOSIX shared memory segments; seqlock protocol (lock-free reads, single-writer); sub-microsecond read latency; same-host onlyposition-accumulator (/pks-positions-v1); valuation-hub greeks-aggregator (/pks-greeks-v1); md-mark-loader (/md-marks-v1)pks-bff, Atlas Qt, algo strategies/pks-positions-v1 · /pks-greeks-v1 · /md-marks-v1

ComponentStackConnection to BFFData consumedAuth
atlas-webReact 18 · Vite · TypeScript · AG Grid · Zustand · TanStack QueryREST /api/v1/* (GET/POST/PATCH/DELETE) + WebSocket /ws?token=<jwt>Positions, trades, blotter, cash balances, OCP, payment orders, curves, reports, settlement, reconciliation, orders, ref dataJWT Bearer (access_token + refresh_token)
Atlas QtC++ · Qt 6 · CMakegRPC TLS :8443 (PositionsSimulatorService) + direct SHM read (same host)PositionViewPatch stream; instrument static updates; direct SHM PositionSlot for < 1 µs latencyJWT (gRPC metadata Authorization: Bearer)
Algo strategiesRust / PythonNATS JetStream (via algo-data-bus) + direct SHM read (same host)PositionUpdated, PositionValuated, direct SHM readsNATS credentials (NKey)

3.4 Library Crates (shared logic, no binary)

Section titled “3.4 Library Crates (shared logic, no binary)”
CrateUsed byPurpose
bo-canonicalAll servicesCanonical proto definitions (pks_service, position, trade, instrument_static); NATS subject constants
backoffice-protoOps servicesLegacy backoffice proto definitions (collateral, confirmations, dispute, ledger, positions, reconciliation, settlement)
bo-lotmatchposition-accumulatorFIFO / LIFO / WA lot matching; realised P&L computation
bo-instrument-domaintrade-booker, trade-capture-lifecycleInstrument domain model and classification
bo-instrument-resolvetrade-capture-lifecycle, pks-bffInstrument ID resolution across ISIN, CUSIP, FIGI, RIC
bo-instrument-staticspks-bff, valuation-hubInstrument static data cache and enrichment
bo-validationtrade-capture-lifecycle, trade-bookerTrade and booking validation rules
bo-shm-bridgeposition-accumulator, pks-bff, valuation-hubSHM segment reader/writer; seqlock protocol
bo-ledgerledger-serviceDouble-entry ledger domain model
bo-templatereport-engineReport template engine
bo-query-apipks-bff, bo-batch-apiShared query parameter types and SQL builders
field-catalogposition-accumulator, valuation-hub, pnl-engineTier 0–3 field registry; inventory! macro; versioned field definitions
position-typesposition-accumulator, pks-bff, position-snapshot-writerShared position data types
pricing-input-mapvaluation-hub, pks-bffMaps position fields to PriceRequest input structs
valuation-corevaluation-hubCore valuation types and model dispatch
mavr-fx-convertposition-accumulator, pnl-engine, cash-position-service-v2FX conversion to functional currency
mavr-circuit-breakerpks-bff, valuation-hubCircuit breaker for external gRPC calls
mavr-leader-electionbo-eod-aggregate, report-schedulerPostgres-backed leader election for singleton services
mavr-shutdownAll servicesGraceful shutdown coordination (SIGTERM handler)
backoffice-routing-rulesbo-book-routerBook routing rule evaluation

All NATS subjects follow <domain>.<entity>.<version>.<qualifier>. All streams use JetStream with durable pull consumers.

SubjectPublisherConsumer(s)PayloadNotes
backoffice.booking.v1.TradeBookedtrade-capture-lifecycle · trade-booker · bo-allocation · bo-batch-api · cashflow-accrual-engine · xfer-engine · otc-lifecycle-serviceposition-accumulator · bo-book-router · ledger-service · settlement-service · confirmations-service · corp-actions-service · collateral-service · questdb-trade-writerTradeBooked protoPrimary trade ingestion subject; all booking sources converge here
backoffice.booking.v1.LifecycleEventAppliedtrade-capture-lifecycle · otc-lifecycle-serviceposition-accumulator · settlement-serviceLifecycleEventApplied protoAmend, cancel, novation, give-up events
backoffice.booking.v1.TradeRejectedtrade-capture-lifecyclemavr-dlq-reaper · ops alertsRejection reasonFailed validation; moves to DLQ
SubjectPublisherConsumer(s)Payload
bo.position.updated.v1position-accumulatorpks-bff · valuation-hub · pnl-engine · position-reconcilerPositionUpdated proto
bo.position.valuated.v1valuation-hubpks-bff · pnl-engine · collateral-service · regulatory-reporterPositionValuated proto
bo.pnl.attributed.v1pnl-enginepks-bff · report-enginePnLAttributed proto
SubjectPublisherConsumer(s)Payload
md.mark.v1.{instrument_id}md-mark-loadervaluation-hubMark price + timestamp
md.ohlc.v1.{instrument_id}market-data-processorquestdb-trade-writerOHLC bar
SubjectPublisherConsumer(s)Payload
bo.cash.ledger.v1ledger-servicecash-position-service-v2CashLedgerEntry
bo.cash.balance.v1cash-position-service-v2pks-bff · open-currency-position-serviceCashBalance
bo.cash.ocp.v1open-currency-position-servicepks-bffOcpPosition
bo.cash.payment_order.v1ledger-servicepks-bffPaymentOrder
SubjectPublisherConsumer(s)Payload
bo.report.generated.v1report-enginepks-bff · report-distributorReport ID · run ID · desk · date · seal hash
bo.report.edit.v1report-enginepks-bffEdit metadata · section · user
bo.report.locked.v1report-enginepks-bffDesk · date · locked_at
SubjectPublisherConsumer(s)Payload
bo.settlement.v1settlement-servicepks-bff · reconciliation-serviceSettlement status update
bo.recon.v1reconciliation-service · bo-recondispute-service · pks-bffReconciliation result · breaks
bo.ca.v1corp-actions-serviceposition-accumulator · pks-bffCorporate action event
bo.collateral.v1collateral-servicepks-bff · ops alertsMargin call
*.dlq.*NATS server (undeliverable)mavr-dlq-reaperOriginal message + failure reason

ServiceProtocolPortBindingNotes
pks-bffHTTP (REST + WS)80800.0.0.0:8080 → nginx proxyAll /api/v1/*, /auth/*, /ws, /health
pks-bffgRPC TLS84430.0.0.0:8443PositionsSimulatorService; used by Atlas Qt and algo clients
pricing-enginegRPC50051mavr-backend networkInternal only; called by valuation-hub and pks-bff
atlas-webHTTP80mavr-edge networknginx-served SPA; proxies /api, /auth, /wspks-bff:8080
atlas.mavr.financeHTTPS443Edge nginxTLS termination → atlas-web:80
NATSNATS4222mavr-backendJetStream; all services connect here
PostgresTCP5432mavr-backendAll back-office services
RedisTCP6379mavr-backendMarks, JWT blocklist, sessions
QuestDBHTTP (ILP)9000mavr-backendILP ingestion (questdb-trade-writer)
QuestDBHTTP (query)9000mavr-backendSQL query (pks-bff, md-query-api)

Every component that mutates state is designed for idempotent replay:

ComponentRecovery mechanismIdempotency key
position-accumulatorLoad latest position_snapshot checkpoint; replay TradeBooked from NATS JetStream sequencetrade_id (duplicate = no-op)
ledger-servicePostgres transaction with ON CONFLICT DO NOTHINGtrade_id + leg
settlement-servicePostgres UPSERT on trade_idtrade_id
trade-booker24 h idempotency cache keyed by idempotency_hashidempotency_hash (client-supplied)
questdb-trade-writerQuestDB dedup on trade_id timestamp columntrade_id + trade_time
pks-bff (SimulatorService)Full snapshot pushed to each new subscriber; no durable state lossNATS consumer sequence
report-engineReport run is idempotent; re-running for same (desk, date) produces same result(desk_id, business_date, version)