Case Study — AstraFi
Real-Time Portfolio Risk Intelligence for a Multi-Strategy Hedge Fund
Sub-200ms risk runs replacing a 4-hour overnight batch across 50,000+ positions
Industry
Institutional Finance / Hedge Fund
Timeline
12 weeks
Team
6 engineers
Tech
Python + ClickHouse + WebSocket
The Challenge
A multi-strategy hedge fund needed real-time portfolio risk calculations across 50,000+ positions spanning equities, fixed income, derivatives, and digital assets. Their existing Murex-based system required a 4-hour overnight batch to produce risk figures — figures that were stale before traders saw them. Intraday risk was managed by intuition.
Our Approach
How We Solved It
Real-Time Position Feed Integration
Built a unified position feed aggregating from prime brokers, OMS systems, and digital asset custodians, normalizing all positions into a canonical risk data model with sub-second latency from trade execution.
Incremental Risk Calculation Engine
Designed an incremental risk calculation architecture that recalculates risk only for positions affected by market data changes or trade executions — reducing per-update computation by 97% versus full portfolio recalculation.
Multi-Model Risk Framework
Implemented 8 concurrent risk models (Historical VaR, Monte Carlo, Greeks, Factor, Liquidity, Concentration, Leverage, Drawdown) running on the same position data with a shared market data cache.
Limit Breach Alerting
Real-time limit monitoring across all 8 risk dimensions with configurable thresholds per fund, strategy, and portfolio manager — alerting within 200ms of any limit approach or breach.
Engineering Process
How We Built It
Risk Calculation Vectorization
Rewrote Python risk calculations using NumPy vectorization and Numba JIT compilation, achieving 40x speedup over the prior loop-based implementation — critical for sub-second incremental recalculation.
Shared Market Data Cache
Redis Streams publishes market data updates to all 8 risk models simultaneously with microsecond latency, ensuring all models compute risk on exactly the same market snapshot.
Historical Scenario Pre-Computation
Historical VaR scenarios are pre-computed and stored in ClickHouse, reducing real-time VaR to a single weighted aggregation rather than a full scenario replay — bringing P99 VaR latency to 18ms.
Architecture Decisions
Key Technical Choices
Incremental Over Full Recalculation
Full portfolio recalculation on every market data tick would require 100x the compute. Incremental recalculation — updating only affected positions — is the architectural decision that makes real-time risk feasible.
ClickHouse for Scenario Analytics
Historical scenario storage in ClickHouse vs PostgreSQL delivered 200x query speedup on VaR scenario lookups, reducing the database from the bottleneck to a non-factor in overall risk latency.
WebSocket Push for Trader Consumption
Risk figures are pushed to trader dashboards via WebSocket as soon as they update — traders see risk changes within 200ms of a market move rather than refreshing a dashboard.
Results
What We Delivered
Solution Blueprint
How It All Fits Together
- Prime broker integrations
- OMS connectivity
- Digital asset position normalization
- 8 concurrent risk models
- Incremental recalculation
- Shared market data cache (Redis)
- WebSocket risk push to traders
- Limit breach alerting (<200ms)
- Risk attribution dashboard
Lessons Learned
What We Improved
Incremental Architecture Must Be Designed From Day One
We prototyped full recalculation first to validate correctness, then redesigned for incremental — retrofitting incrementality is much harder than designing for it from the start.
Traders Need Context, Not Just Numbers
Risk figures alone weren't adopted. Adding the top 5 contributors to each risk metric and comparison to prior-day positions made the dashboard the primary risk tool within 2 weeks.
Real-Time Risk Changes Risk Management Behavior
With real-time risk visibility, portfolio managers began using intraday risk figures for active position management. This was the desired outcome but required new operational procedures we hadn't initially scoped.
More From AstraFi
Related Case Studies
Institutional Finance / Digital Assets
Digital Asset Operations Platform
SOC 2 Type II digital asset custody and settlement for institutional allocators
Fintech / Payments
Treasury Management System
From 2-day cash forecasting in spreadsheets to real-time treasury intelligence
Digital Asset Exchange / Fintech
Compliance Automation Platform
87% false positive reduction and same-day KYC for a $500M/month digital asset exchange
Related Research
Research Reports for This Industry
Enterprise AI Adoption Trends 2026
Enterprise AI has crossed the operational threshold. Seventy-two percent of Fortune 500 organizations now run at least one AI system in production — and the average enterprise manages 3.4 concurrent AI initiatives. This report maps the state of enterprise AI across healthcare, manufacturing, financial services, retail, and beyond.
Read reportFintech AI Adoption Report 2026
Financial services organizations are navigating a pivotal transition in AI adoption — moving from exploratory pilots toward enterprise-scale deployments that are becoming load-bearing infrastructure within core business processes. The 2026 landscape is defined not by whether to adopt AI, but by how to deploy it responsibly, at what pace, and within which governance architecture. Incumbent banks, c...
Read reportBanking Automation Trends 2026
Banking automation has moved well past the proof-of-concept phase. The institutions that have captured the most value are not those that deployed the most bots or launched the most AI pilots — they are the ones that built automation as a strategic capability, with deliberate governance, disciplined sequencing, and organizational structures that treat process intelligence as a core competency. In 2...
Read reportFraud Detection Market Analysis 2026
Fraud detection has entered a structural transformation driven by the convergence of real-time payment rails, AI-native decisioning architectures, and increasingly sophisticated adversarial fraud operations. For financial institutions, payment processors, and fintech platforms, the ability to detect and prevent financial crime in real time is no longer a compliance checkbox — it is a core operatio...
Read reportExplore Further
Work With Halkwinds
Build Something Exceptional
Partner with the team that built AstraFi.