05 / 09, 2025

Risk

A real time portfolio risk management dashboard for VaR, stress tests, correlations, and live monitoring.

Role

Solo engineer, FastAPI risk engine, React dashboard, WebSocket monitoring

Stack

FastAPI · React · TypeScript · React Query · WebSocket · VaR · Stress testing · Correlation analysis

The Problem

The README positions this as a real time portfolio risk management system with comprehensive risk analysis: VaR, stress testing, correlation analysis, and live market data monitoring.

It is also designed to be explorable without API keys, using realistic demo data and simulated feeds so users can learn the risk concepts immediately.

The Architecture

01FastAPI risk backend

The backend centers on app.py, risk_engine.py, and market_data.py, exposing endpoints for all dashboard data, risk metrics, VaR analysis, correlation matrices, portfolio holdings, stress testing, and WebSocket live data.

02React + TypeScript dashboard

The frontend is split into Dashboard, VaRAnalysis, StressTest, CorrelationMatrix, LivePrices, MarketIndices, and DemoData components, with hooks for WebSocket management and risk data fetching.

03Multiple data source strategy

The README supports free generated data and CoinGecko, plus optional Alpha Vantage, Twelve Data, and Finnhub keys for live market data.

Decisions that mattered

1.

Teach while showing the metric

Contextual help, explanations, educational banners, color coded charts, and formula sections make VaR, stress testing, correlation, and Sharpe ratio understandable instead of opaque.

2.

Optimize dashboard performance

Lazy loading, React Query caching, hover based preloading, performance monitoring, and WebSocket fallback keep the real time surface responsive.

3.

Offer demo mode first

Realistic demo data removes setup friction, letting the dashboard demonstrate portfolio risk concepts before users connect live market providers.

The Numbers

WS

live updates

3

VaR levels

6

core views

30s

cache stale time

What it taught me

Risk dashboards work best when they combine live numbers with explanations that help the user interpret what changed.

A no key demo mode is not a shortcut; it is a better first run experience for technical financial tooling.