Skip to content

selected case study

GS Quant Risk Analytics

A value-at-risk and expected-shortfall application built on a fork of Goldman Sachs' open-source gs-quant library: it measures the risk of a series or a portfolio and then tests whether the VaR model deserves to be trusted, with every forecast judged on the return that followed it.

Role fit

Data ScientistQuantitative RiskApplied ML Engineering

Quick technical review

The case study in four points.

Full methodology

Problem

A VaR figure is only as good as the model behind it, and a model fitted to a long trailing window can look fine on average while being late every time the market changes. A risk number needs to come with the test of whether it has been right.

Architecture

A risk_metrics module inside the library (historical, parametric and Cornish-Fisher VaR, expected shortfall, drawdown, Sortino, Calmar, Omega, tracking error, information ratio, and the backtests) is used by a Starlette application with…

Read complete note

A risk_metrics module inside the library (historical, parametric and Cornish-Fisher VaR, expected shortfall, drawdown, Sortino, Calmar, Omega, tracking error, information ratio, and the backtests) is used by a Starlette application with Pydantic-validated requests and SQLite storage for saved analyses and named portfolios, and by four analytics tools added to the library's MCP server so an LLM agent can call the same calculations. Daily prices come from Yahoo Finance by symbol, converted to one currency at the daily exchange rate, with the last copy used and dated when the provider is down.

Results

VaR backtested with Kupiec, Christoffersen and Basel traffic light

Limitations & scope

Daily closes only, no intraday or real-time prices. The demo runs on simulated GARCH(1,1) data with Student-t innovations, precomputed by the Python code. The deployment files have not been run end to end, and the README says so. The upstream…

Read complete note

Daily closes only, no intraday or real-time prices. The demo runs on simulated GARCH(1,1) data with Student-t innovations, precomputed by the Python code. The deployment files have not been run end to end, and the README says so. The upstream library and its Marquee APIs are Goldman Sachs' and are not part of this work.

Summaries reuse the project’s documented evidence. Review the complete case study for evaluation boundaries.

Evidence-led visual review

Explore the actual work.

Actual project screenshots and repository figures are shown with source provenance.

GS Quant Risk Analytics public demo captured 2026-10-12

Dated demo screenshot

Public demonstration screenshot dated 2026-10-12; does not establish that the demo is currently online.

Open published source

VaR backtested with Kupiec, Christoffersen and Basel traffic light

Regime shift: rolling VaR breached 63 times vs 37.5 expected; EWMA 41

Square-root rule rejected: 8 breaches in 75 stretches vs 3.75

Releases 0.1.0 and 0.1.1, public container image, two live demos

Project proof

Verified external evidence

Last verified 2026-10-07

Problem and approach

Problem

A VaR figure is only as good as the model behind it, and a model fitted to a long trailing window can look fine on average while being late every time the market changes. A risk number needs to come with the test of whether it has been right.

Architecture

A risk_metrics module inside the library (historical, parametric and Cornish-Fisher VaR, expected shortfall, drawdown, Sortino, Calmar, Omega, tracking error, information ratio, and the backtests) is used by a Starlette application with Pydantic-validated requests and SQLite storage for saved analyses and named portfolios, and by four analytics tools added to the library's MCP server so an LLM agent can call the same calculations. Daily prices come from Yahoo Finance by symbol, converted to one currency at the daily exchange rate, with the last copy used and dated when the provider is down.

Validation

Each VaR forecast is made from the previous window only and compared with the return that followed. The Kupiec frequency test, the Christoffersen independence and conditional coverage tests and the Basel traffic light turn the breaches into a verdict. A filtered (EWMA) estimate is backtested over the same periods as the rolling window, and the square-root-of-time rule for multi-period figures is itself checked over non-overlapping stretches, because overlapping ones break the independence the Kupiec test needs.

What the checks show

On the simulated Regime shift sample (1,000 periods, a calm market that turns turbulent) the 250-period rolling 95% VaR is breached 63 times against 37.5 expected, the EWMA estimate 41 times. The square-root rule is rejected by its own check, 8 breaches in 75 stretches against 3.75 expected, and a filtered historical simulation gives a 10-period 95% VaR of 12.0% where the rule gives 4.9%. These are properties of a simulated sample chosen to show the failure, not results on a real book.

Portfolio and scenarios

Portfolios of two to ten assets at constant weights, with Euler allocations of volatility and expected shortfall that add up exactly to 100%, the diversification ratio and the correlation matrix. Stress windows show the worst 1, 5 and 20 consecutive periods that actually occurred; what-if scenarios apply shocks of the user's own and are deliberately first-order, with no assumed betas or correlations. A benchmark adds beta, tracking error, the information ratio, up and down capture ratios and a rolling beta.

Delivery

Two releases (0.1.0 and 0.1.1) were published by a release workflow that runs the CI checks, builds the image, starts it once to check the version it reports, pushes it to ghcr.io and creates the GitHub release from the changelog; the image is public and a tagged release also installs with pip straight from the repository. The application refuses to listen beyond localhost without an API token, and applies a request-rate limit and a lockout after repeated wrong tokens. CI runs ruff, the test suite across Python versions, a Playwright test that drives the application in a real browser with axe-core accessibility checks, and a Docker job that checks the token refusal and scans the image. Saved analyses export to a stand-alone HTML report, an Excel workbook whose figures stay numbers and whose text cannot become a formula, and a print stylesheet for PDF.

What is not claimed

Daily closes only, no intraday or real-time prices. The demo runs on simulated GARCH(1,1) data with Student-t innovations, precomputed by the Python code. The deployment files have not been run end to end, and the README says so. The upstream library and its Marquee APIs are Goldman Sachs' and are not part of this work.

Why it matters

It is the market-risk counterpart to the MSCapital forecasting study: the same habit of judging a model only on data it had not seen, applied to the question a risk desk asks every day, and shipped as a tool someone else can install and use.

Architecture and analysis

  • Treats VaR as a forecast to be backtested, not a number to be reported.
  • Shows where the usual shortcuts fail (a long trailing window, the square-root-of-time rule) and offers the alternative beside them.
  • Ships as an installable, tested application with releases, a container image and a live demo.

Testing and validation

  • gs_quant/timeseries/risk_metrics.py: VaR, expected shortfall, Kupiec and Christoffersen backtests, Basel traffic light
  • gs_quant/apps/risk_dashboard: the application, with English and Turkish interfaces and a test that every text is translated
  • MCP analytics tools: risk summary, VaR backtest, benchmark comparison and asset risk from symbols
  • Browser test with axe-core, Docker job, image scan, release workflow and changelog

Operational value

  • Backtests every VaR forecast on the return that followed it, with Kupiec, Christoffersen and Basel traffic-light verdicts.
  • On a simulated regime shift, a 250-period rolling 95% VaR is breached 63 times against 37.5 expected; the EWMA estimate, 41 times.
  • Rejects the square-root-of-time rule on its own non-overlapping check (8 breaches in 75 stretches, 3.75 expected) and offers a filtered historical simulation instead.
  • Analyses portfolios of up to ten assets in mixed currencies, with Euler risk shares, stress windows, what-if shocks and benchmark statistics.
  • Releases 0.1.0 and 0.1.1 with public ghcr.io images, and live demos on Hugging Face Spaces and GitHub Pages.

How to inspect

  • Open the live demo and pick the Regime shift sample: the rolling VaR and the filtered one are drawn on the same chart.
  • Read risk_metrics.py and its tests before the application: that is where the backtests are.
  • Filter the commit history by author to separate this work from the upstream library.

Related case studies

All projects