Design a Real-Time Firmwide Risk and PnL Aggregation Service

Last updated: November 29, 2026

Quick Overview

Design a service that consumes positions, fills and live market data for hundreds of independent pods, computes intraday PnL, exposures and risk sensitivities per pod and firmwide, and enforces drawdown and exposure limits within seconds.

Millennium
System Design
Software Engineer
Millennium
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design a service that consumes positions, fills and live market data for hundreds of independent pods, computes intraday PnL, exposures and risk sensitivities per pod and firmwide, and enforces drawdown and exposure limits within seconds.

Millennium runs many independent teams under a central risk function that watches each pod's exposure and drawdown and can cut capital quickly, so a real-time risk view is core infrastructure. The interviewer wants to see event-driven aggregation, a clear story for pricing at scale, correctness under late or amended fills, and how limit breaches reach a human fast.

What the Interviewer Expects
  • Separates position keeping (event sourced from fills) from valuation (positions times live prices and sensitivities)
  • Uses incremental aggregation up a pod, strategy, firm hierarchy instead of full recompute
  • Handles expensive instruments (options, credit) with a pricing grid or cached greeks and a refresh cadence
  • Defines limit evaluation, alerting and an audit trail for breaches
  • Plans for start-of-day reconciliation against the books and replay from the log
  • Discusses isolation so one pod's bad data cannot poison firmwide numbers
Key Topics to Cover
Event sourcing
Stream processing
Hierarchical aggregation
Risk limits
Pricing library
Reconciliation
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you guarantee the firmwide number equals the sum of pod numbers at any instant?
  • A market data outage freezes prices for one exchange. What does the risk screen show?
  • How would you support what-if scenarios (rates +100bp) for all pods in under a minute?
  • How do you handle a pod booking trades in an instrument the pricing library does not support yet?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: per pod and firmwide intraday PnL, gross and net exposure, beta and factor exposures, DV01 and vega where relevant; limit checks (drawdown from high-water mark, gross, single-name concentr...

High-Level Design

Fills from OMS and prime brokers land on Kafka, partitioned by pod. A position service folds fills into positions (event sourced, idempotent on fill id) and publishes position deltas. A **market d...


Submit Your Answer
Markdown supported

Related Questions