Skip to content

This repository demonstrates beta hedging using Oracle (ORCL) and the S&P 500 ETF (SPY). It includes explanations of factor models, beta calculation, risk exposure, and hedging implementation.

Notifications You must be signed in to change notification settings

Bominkkwon/Beta_Hedging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Beta Hedging with Oracle (ORCL) and the S&P 500 (SPY)

This repository demonstrates beta hedging using Oracle (ORCL) and the S&P 500 ETF (SPY). It includes explanations of factor models, beta calculation, risk exposure, and hedging implementation.


Overview

Beta hedging is a strategy to reduce the impact of market movements on a portfolio.

  • Beta ($\beta$) measures an asset's sensitivity to a factor, usually the market.
  • Alpha ($\alpha$) represents returns independent of the market.
  • Hedging creates a market-neutral portfolio, where returns are mostly alpha and volatility is reduced.

Factor Models

A factor model explains the returns of an asset as a linear combination of factors:

$$ Y = \alpha + \beta_1 X_1 + \beta_2 X_2 + \dots + \beta_n X_n + \epsilon $$

Where:

  • $Y$ = asset returns (Oracle in this case)
  • $X_i$ = factor returns (market index, sector ETF, etc.)
  • $\alpha$ = return independent of factors
  • $\beta_i$ = sensitivity to factor $X_i$
  • $\epsilon$ = noise

A single-factor model for Oracle vs the market:

$$ R_{ORCL} = \alpha + \beta \cdot R_{SPY} + \epsilon $$


Beta Formula

$$ \beta = \frac{\text{Cov}(R_{ORCL}, R_{SPY})}{\text{Var}(R_{SPY})} $$

  • Measures how Oracle moves relative to the market
  • High beta → more volatile, follows the market closely
  • Low beta → less sensitive to market swings
  • Beta = 0 → market-neutral

Risk Exposure

  • High beta means larger gains in a rising market and larger losses in a falling market.
  • Low or negligible beta indicates returns mostly independent of the market.
  • Market-neutral portfolios focus on asset-specific performance, providing stable returns across market conditions.

Hedging Implementation

  1. Obtain price data for ORCL and SPY.
  2. Calculate daily returns from price data.
  3. Estimate beta:

$$ R_{ORCL} = \alpha + \beta \cdot R_{SPY} + \epsilon $$

  1. Construct a hedged portfolio:

$$ R_{Hedged} = R_{ORCL} - \beta \cdot R_{SPY} $$

  1. Evaluate hedged portfolio:

    • Alpha: independent performance
    • Beta: reduced market exposure
    • Volatility: lower risk

Market Neutrality

  • A portfolio with beta ≈ 0 is market-neutral
  • Returns are driven primarily by asset-specific factors (alpha) rather than market movements

Notes on Estimation

  • Beta is estimated from historical data and may change over time.
  • Hedging using historical beta may not fully remove market risk.
  • Beta estimates have standard errors; frequent recalculation improves hedging accuracy.

Beta Hedging Example – Oracle (ORCL) vs SPY


Method

  1. Download Data: Daily prices for ORCL and SPY using yfinance.

  2. Compute Returns: Calculate daily percent changes.

  3. Estimate Beta: Linear regression of ORCL returns against SPY returns to find alpha and beta.

  4. Construct Hedged Portfolio:

    Hedged Portfolio = ORCL returns - (beta × SPY returns)
    
  5. Analyze Portfolio: Compare volatility, average return, and alpha before and after hedging.

  6. Out-of-Sample Test: Apply the hedge to a future period to test stability.


Results

  • Reduced Volatility: The hedged portfolio is smoother than ORCL alone.
  • Market Neutral: Beta ≈ 0 — the portfolio no longer follows SPY movements.
  • Alpha Preserved: Small positive returns remain, independent of the market.
Metric ORCL Hedged ORCL
Average Daily Return -0.000038 0.000592
Volatility (Std Dev) 0.0193 0.0136
Beta vs SPY 1.0+ ~0

Conclusion

This example demonstrates how beta hedging can isolate a stock’s intrinsic performance, reduce market-driven risk, and create a more stable, market-neutral portfolio.


Libraries Used

  • yfinance – for historical stock prices
  • numpy – numerical operations
  • matplotlib – plotting
  • statsmodels – regression analysis

About

This repository demonstrates beta hedging using Oracle (ORCL) and the S&P 500 ETF (SPY). It includes explanations of factor models, beta calculation, risk exposure, and hedging implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published