Skip to content

valeman/calibrated-returns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CalibratedReturns

Prediction intervals for stock returns using conformal prediction.

Overview

Outputs 5-day return intervals for any ticker. The intervals have coverage guarantees - if you ask for 90% coverage, backtesting shows ~90% of actual returns fall within the intervals.

  • Model: Quantile regression trained on ~20 features (momentum, volatility, RSI, MA distances, etc.)
  • Calibration: Split conformal prediction to adjust intervals based on recent residuals
  • Validation: Walk-forward backtesting to verify coverage holds out-of-sample

Backtest results (SPY, AAPL, MSFT, GOOGL, NVDA, 2021-2024):

  • Target: 95% coverage
  • Actual: 92.3% coverage
  • 3,755 total predictions

Run locally

Backend:

cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

Frontend:

cd frontend
npm install
npm run dev

API

curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"tickers": ["SPY", "AAPL"], "coverage": 0.9}'

Stack

  • FastAPI, scikit-learn, yfinance
  • React, Recharts
  • Data from Yahoo Finance
1 2

About

CalibratedReturns - Conformal Prediction for Portfolio Returns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 61.5%
  • JavaScript 37.7%
  • Other 0.8%