End of Day Risk Aggregation Across Millions of Trade Positions

Last updated: November 29, 2026

Quick Overview

Design the batch platform that each evening revalues every trading position under hundreds of historical and stress scenarios, aggregates VaR and stress losses along desk, legal entity and counterparty hierarchies, and delivers reports to risk managers and regulators by early morning.

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

0

0

0 solved


Design the batch platform that each evening revalues every trading position under hundreds of historical and stress scenarios, aggregates VaR and stress losses along desk, legal entity and counterparty hierarchies, and delivers reports to risk managers and regulators by early morning.

Market risk reporting is a regulatory obligation for a global systemically important bank like UBS, and the batch has to finish before the next trading day across Zurich, London, New York and Asia. UBS has moved much of its compute to Microsoft Azure, which makes elastic grids a realistic answer. The interviewer looks for decomposition of a huge compute job, correct non-additive aggregation, and operational robustness.

What the Interviewer Expects
  • Separate scenario generation, revaluation and aggregation stages
  • Explain why VaR is not additive and store scenario P&L vectors instead of VaR numbers
  • Size the compute and partition it for an elastic grid
  • Handle late or failed inputs and partial reruns
  • Provide lineage and reproducibility for regulators
Key Topics to Cover
Batch Processing
Distributed Compute Grid
Non-Additive Aggregation
Data Lineage
Cloud Elasticity
Market Risk
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
  • A trader books a large trade after cutoff: how do you incorporate it without rerunning everything?
  • How would you support an ad hoc what-if query, such as adding a hedge, during the day?
  • How do you validate that a revaluation result is not silently wrong?
  • What changes for FRTB Expected Shortfall with liquidity horizons?
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

Inputs at cutoff: about 5 million positions, market data snapshot (curves, vol surfaces, FX), 500 historical scenarios plus 200 stress scenarios, static data and hierarchies. Outputs by 06:00 Zurich: ...

High-Level Design
  1. Snapshot: freeze positions and market data at cutoff with a run id; every downstream artifact is keyed by it.
  2. Scenario builder: turns historical shifts and stress definitions into shocke...

Submit Your Answer
Markdown supported

Related Questions