maps a stock portfolio's implicit macro bets to live polymarket prediction markets and sizes hedges where tradfi diverges from the crowd. yale hack 2025.
| layer | tools |
|---|---|
| market data | yfinance, fredapi |
| factor regression | statsmodels ols |
| prediction markets | polymarket rest api |
| numerics | numpy, pandas, scipy, scikit learn |
| frontend | typescript |
- regress each holding against 18 macro factors to get per factor betas
- dollar weight betas into one portfolio factor profile
- map factors to polymarket categories, derive a tradfi implied probability
- classify the gap vs market price: under 8pp noise, 8 to 15pp hedge, over 15pp strong
- size with quarter kelly, 3% single position cap, 10% total
pip install -r requirements.txt
export FRED_API_KEY=... # free at fred.stlouisfed.org
python3 -m polyhedge.pipeline --portfolio portfolio_example.jsonoutputs json with per market divergence (tradfi implied minus polymarket price),
effective_edge (confidence discounted, used for sizing), and insurance_cost_pct.