Skip to main content

Reproducible research package for Value at Risk, Conditional Value at Risk, and tail-risk analysis.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asr_var_cvar_tail_risk-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file asr_var_cvar_tail_risk-1.0.0.tar.gz.

File metadata

  • Download URL: asr_var_cvar_tail_risk-1.0.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for asr_var_cvar_tail_risk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0c03ee2cbfbf28c8a17d367713d02035c4c79087b122a95df812652c60c0f478
MD5 a2b75eccba03a587a466c1bf91d4be5f
BLAKE2b-256 f303addc7d91d75010cf71be3a8d923b20ede2f8fbb82e50d036e811232ead24

See more details on using hashes here.

Provenance

The following attestation bundles were made for asr_var_cvar_tail_risk-1.0.0.tar.gz:

Publisher: publish-pypi.yml on Alpha-Stochastic-Research/asr-var-cvar-tail-risk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2137b04ec79e878655cb7fd301689d3994ae8c99c4900fc57c1cd0db0e9c1d99
MD5 c0d61fc040a7bfce38e498b5a8d672ca
BLAKE2b-256 45a6d40946c06fbfe3eb1c9371d1be675b3a475964c5a78e4bb9e9bf92e3af79

See more details on using hashes here.

Provenance

The following attestation bundles were made for asr_var_cvar_tail_risk-1.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Alpha-Stochastic-Research/asr-var-cvar-tail-risk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page