Skip to main content

Uncertainty quantification for financial time series via conformal prediction

Project description

Conformal Finance

Distribution-free uncertainty quantification for financial time series.

Mission: Replace meaningless RMSE metrics with calibrated prediction intervals that maintain valid coverage even when financial regimes shift.

Finance ML usually reports point forecasts. Point forecasts hide tail risk. Conformal prediction gives non-parametric, finite-sample coverage guarantees — but almost no public code targets non-stationary financial data. ConformalFinance does exactly that.

What you can do with it

  • Wrap any point forecast in valid prediction intervals using split, CQR, or rolling conformal prediction.
  • Adapt to distribution shift online with adaptive conformal inference (ACI).
  • Forecast returns, realized volatility, and VaR with calibrated intervals.
  • Diagnose empirical coverage, interval width, and conditional coverage by regime.
  • Load real market data (optional yfinance) or realistic synthetic AR/GARCH series.
  • Visualize coverage and width traces (optional matplotlib/plotly).

Install

pip install conformal-finance

For development, docs, and optional data / plotting support:

pip install -e ".[dev]"

Quickstart

import pandas as pd
from conformal_finance.conformal.split import SplitConformalPredictor
from conformal_finance.data.synthetic import generate_ar_garch_returns

# Realistic synthetic returns
returns = generate_ar_garch_returns(n=2000, seed=42)

# Build a trivial point forecast: yesterday's return
y_true = returns.iloc[1:].reset_index(drop=True)
y_pred = returns.iloc[:-1].reset_index(drop=True)

# Split conformal intervals
cp = SplitConformalPredictor(alpha=0.1)
cp.fit(y_true_cal=y_true.iloc[:500], y_pred_cal=y_pred.iloc[:500])
intervals = cp.predict(y_pred_test=y_pred.iloc[500:])

print(intervals.head())

Design

  • Core conformal methods are implemented from scratch so the API stays stable and lightweight.
  • Optional extras (yfinance, matplotlib, plotly) are imported lazily and never required for import.
  • scikit-learn-style interface: every predictor exposes .fit() / .predict() or equivalent streaming methods.
  • Type hints and numpy/pandas idioms throughout.

Project layout

conformal_finance/
├── conformal/       # Split, CQR, ACI, Rolling conformal predictors
├── finance/         # Returns, volatility, VaR conformalizers
├── diagnostics/     # Coverage, width, and regime diagnostics
├── data/            # Synthetic AR/GARCH generators and yfinance loader
└── viz/             # Coverage/width plotting helpers

Documentation

Full docs are built with MkDocs and hosted at https://satyamdas03.github.io/conformal-finance/.

Local build:

mkdocs serve

Roadmap

Version Focus Status
v0.1.0 Split, CQR, ACI, rolling; returns, vol, VaR; diagnostics In progress
v0.2.0 Realized ES, drawdown, and factor-return targets Planned
v0.3.0 GARCH / historical-simulation benchmarks Planned
v0.4.0 Portfolio sizing and vol targeting Planned
v0.5.0 Research note + integration with FactorForge Planned

License

MIT © 2026 Satyam Das

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

conformal_finance-0.1.1.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

conformal_finance-0.1.1-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file conformal_finance-0.1.1.tar.gz.

File metadata

  • Download URL: conformal_finance-0.1.1.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for conformal_finance-0.1.1.tar.gz
Algorithm Hash digest
SHA256 145b495d0eb1e53fa8a9e546629b79b63bad979c1cc455a0fb431eaa54c1db41
MD5 0e0e598019e949706958c82e20231dc1
BLAKE2b-256 9a955414954c4b1c6ced10c543761100c5f036ea3163a78949c64ca4ddd3d91e

See more details on using hashes here.

File details

Details for the file conformal_finance-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for conformal_finance-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 93a904e3638224328f48489d5a72b5e817ae89f5aea14c3c2f3017383b8a863d
MD5 0833d8c3085b4f8cd70d8b729a9bf024
BLAKE2b-256 a8c61c41ecfd5073f18b1a830b4c873a99834ff9d7de7b80413aed0bf730f3a4

See more details on using hashes here.

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