Skip to main content

Value at Risk versus Conditional Value at Risk

A Rigorous Framework for Measuring Extreme Tail Risk and Regulatory Compliance

Alpha Stochastic Research
Independent Quantitative Finance Research Laboratory

Python Tests License Python CI

Overview

This repository is the reproducible research package for the working paper:

Value at Risk versus Conditional Value at Risk: A Rigorous Framework for Measuring Extreme Tail Risk and Regulatory Compliance

It studies VaR, CVaR, and Expected Shortfall through mathematical analysis, Monte Carlo simulation, robustness checks, backtesting, and regulatory interpretation.

What is included

  • empirical and closed-form VaR/CVaR implementations;
  • the two-defaultable-bond counterexample to VaR subadditivity;
  • Gaussian and standardized Student-t loss models;
  • convergence and tail-thickness sensitivity studies;
  • VaR exception and Kupiec backtesting utilities;
  • a reproducible Jupyter notebook;
  • generated CSV result tables and publication-ready figures;
  • a LaTeX working paper;
  • automated tests and GitHub Actions CI;
  • citation, authorship, license, and reproducibility metadata.

Repository structure

asr-var-cvar-tail-risk/
├── .github/workflows/python-ci.yml
├── docs/METHODOLOGY.md
├── figures/
├── notebooks/var_cvar_reproduction.ipynb
├── paper/
│   ├── main.tex
│   ├── references.bib
│   └── README.md
├── results/
├── scripts/run_analysis.py
├── src/asr_tail_risk/
│   ├── __init__.py
│   ├── backtesting.py
│   ├── models.py
│   ├── plotting.py
│   ├── risk_measures.py
│   └── simulation.py
├── tests/
├── AUTHORS.md
├── CHANGELOG.md
├── CITATION.cff
├── LICENSE
├── Makefile
├── README.md
├── REPRODUCIBILITY.md
├── pyproject.toml
└── requirements.txt

Installation

git clone https://github.com/Alpha-Stochastic-Research/asr-var-cvar-tail-risk.git
cd asr-var-cvar-tail-risk

python -m venv .venv
source .venv/bin/activate        # macOS/Linux
# .venv\Scripts\activate         # Windows

python -m pip install --upgrade pip
pip install -e ".[dev]"

Reproduce everything

python scripts/run_analysis.py
pytest -q

Or:

make reproduce

The analysis writes tables to results/ and figures to figures/.

Baseline experiment

Parameter Value
Portfolio notional USD 10,000,000
Daily volatility 1.2%
Student-t degrees of freedom 4
Monte Carlo paths 200,000
Seed 42
Confidence levels 95%, 97.5%, 99%

The Student-t model is rescaled so that its unconditional volatility matches the Gaussian benchmark.

Package usage

from asr.risk.tail import (
    empirical_var,
    empirical_cvar,
    gaussian_var,
    gaussian_cvar,
    simulate_student_t_losses,
)

losses = simulate_student_t_losses(
    n_paths=200_000,
    notional=10_000_000,
    volatility=0.012,
    degrees_of_freedom=4,
    seed=42,
)

var_99 = empirical_var(losses, 0.99)
cvar_99 = empirical_cvar(losses, 0.99)

Python Import Namespace

The package is distributed under the project name:

asr-var-cvar-tail-risk

The recommended Python import namespace is:

from asr.risk.tail import TailRiskConfig

The legacy namespace remains available for backward compatibility:

from asr_tail_risk import TailRiskConfig

New applications, notebooks, and research scripts should use asr.risk.tail.

Working paper

Compile from the repository root:

cd paper
pdflatex main.tex
bibtex main
pdflatex main.tex
pdflatex main.tex

Citation

Citation metadata are provided in CITATION.cff.

License

MIT License. See LICENSE.

Contact

Alpha Stochastic Research
https://asr-lab.online
research@asr-lab.online

Metadata

Release files for asr-var-cvar-tail-risk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asr-var-cvar-tail-risk 1.0.0
File Size Uploaded Provenance
asr_var_cvar_tail_risk-1.0.0.tar.gz 11.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for asr-var-cvar-tail-risk 1.0.0
File Interpreter ABI Platform
asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / asr_var_cvar_tail_risk-1.0.0.tar.gz

Download URL asr_var_cvar_tail_risk-1.0.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0c03ee2cbfbf28c8a17d367713d02035c4c79087b122a95df812652c60c0f478
BLAKE2b-256 checksum
How to use checksums
f303addc7d91d75010cf71be3a8d923b20ede2f8fbb82e50d036e811232ead24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Release files / asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl

Download URL asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2137b04ec79e878655cb7fd301689d3994ae8c99c4900fc57c1cd0db0e9c1d99
BLAKE2b-256 checksum
How to use checksums
45a6d40946c06fbfe3eb1c9371d1be675b3a475964c5a78e4bb9e9bf92e3af79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

Security for asr-var-cvar-tail-risk 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for asr_var_cvar_tail_risk-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page