Skip to content

Daniel-Ro-Santiago/Option-Pricing-and-Hedging-Strategies-for-Portfolio-Optimization

Repository files navigation

Option-Pricing-and-Hedging-Strategies-for-Portfolio-Optimization

Table of contents

Project overview

This project aims to explore and apply different hedging strategies and portfolio optimization techniques using financial options on a set of stocks. To achieve this, three option pricing models are implemented to compute call and put option premiums:

  • Binomial Trees: A model that simulates the evolution of the underlying asset price over time.

  • Black–Scholes–Merton: An analytical model used for valuing European options.

  • Monte Carlo Simulation: A probabilistic model that generates multiple price paths of the underlying asset to estimate the expected option value.

Then a hedging table is created to analyze the payoff, profit, net gain, and loss of different option strategies (Long Put, Long Call, Short Put, and Short Call) under variations in the underlying asset price. Additionally, potential losses resulting from percentage increases or decreases in stock prices are evaluated.

Finally, a minimum-variance portfolio is constructed using the analyzed assets. Optimal weights, the number of shares to acquire, expected return, volatility, and the Sharpe ratio of the resulting portfolio are computed.

This project provides valuable insights to support informed investment decision-making.

Data

Stock price data were obtained from Yahoo Finance using the following code:

import yfinance as yf

df_precios = pd.DataFrame()
activos = ['BIMBOA.MX', 'GRUMAB.MX','KIMBERA.MX','GAPB.MX','BBVAMA2PV.MX', 'ALFAA.MX']

for i in activos:
  df_precios[i] = pd.DataFrame(yf.Ticker(i).history(start = '2022-01-01', end = '2024-11-08')['Close'])

You can modify the elements in assets and the history parameters to analyze different stocks and time horizons.

Technologies

  • Python
  • Jupyter Notebook

Features

Here is what this project does:

  • Asset Data Acquisition and Preparation: Retrieves historical prices for selected assets over a specified time horizon.
  • Asset Analysis: Computes returns, generates relevant visualizations, and calculates basic statistical measures.
  • Option Valuation: Computes call and put option premiums using Binomial Trees, Black–Scholes–Merton, and Monte Carlo Simulation.
  • Option-Based Hedging Strategies: Evaluates different hedging strategies (Long Put, Long Call, Short Put, Short Call) to understand how options can be used for risk management.
  • Underlying Price Sensitivity Analysis: Examines the impact of percentage changes in asset prices on strategy outcomes.
  • Minimum-Risk Portfolio Construction: Builds a minimum-variance portfolio and computes key performance metrics.

Limitations

The main limitations of this project are:

  • Option pricing models rely on simplifying assumptions:
    • Black-Scholes-Merton assumes constant volatility, constant risk-free rate, and lognormal price dynamics.
    • Binomial Trees assume discrete time steps and simplified market dynamics.
    • Monte Carlo Simulation depends on assumed distributions and parameters.
  • Monte Carlo results depend on the number of simulations and may be affected by computational constraints.

Process

First, stock prices were retrieved using their tickers (in this case, BIMBOA.MX, GRUMAB.MX, KIMBERA.MX, GAPB.MX, BBVAMA2PV.MX and ALFAA.MX) over a defined time horizon (from 2022-01-01 to 2024-11-08). Daily logarithmic returns were computed for each asset, and histograms were generated both jointly and individually to analyze distribution shapes and deviations from normality.

Asset graph

Next, the mean $\mu$ and volatility $\sigma$ (standard deviation) of daily returns were computed and annualized (multiplying the mean by 252 and the volatility by the square root of 252). The latest available closing price for each asset was then obtained and used as the spot price $S_{0}$ for option valuation.

Binomial Trees, Black–Scholes–Merton, and Monte Carlo Simulation models were implemented through three functions to calculate call and put option premiums.

The first function:

opcion_AB()

is used for the Binomial Tree model and takes parameters such as strike price, initial spot price, risk-free rate, volatility, number of steps, and time to maturity, simulating the evolution of the asset price.

The second function:

opcion_BSM()

is used for the Black–Scholes–Merton model and requires the spot price, strike price, volatility, risk-free rate, and time to maturity.

The third function:

simulacion_MC()

implements Monte Carlo simulation and takes the spot price, time to maturity, mean return, volatility of the underlying asset, strike price, risk-free rate, number of simulations, and option type as inputs.

These functions were applied to each asset to compute call and put option prices. The spot price was used as the strike price with a maturity of 0.5 years for the Binomial Tree and Black–Scholes–Merton models, while Monte Carlo simulation was executed with 100,000 simulations and a maturity of 1 year.

Models results

A function was then defined to generate a detailed hedging table with payoffs, profits, unhedged losses, and net gains for different option strategies (Long Put, Long Call, Short Put, Short Call) under various future asset prices. Another function was created to evaluate the impact of a given percentage change in the underlying asset price on the profit and net gain of each strategy.

Finally, an initial capital of $1,000,000 was established, the minimum-variance portfolio was computed, and key metrics such as expected return, volatility and the Sharpe ratio were calculated.

Results

In general, the Binomial Tree and Black–Scholes–Merton models tend to produce very similar call and put option premiums, while Monte Carlo Simulation may yield slightly different values. These differences can be attributed to factors such as the number of simulations, time to maturity, risk-free rate, and, in this case, the inclusion of the expected return in the asset price simulation.

Final recommendation

Although the models and simulations produced similar results, it is crucial to use multiple approaches to obtain a more robust estimate of an option’s fair value and to understand the specific assumptions behind each model. Additionally, analyzing different hedging positions allows us to evaluate whether the benefits of protection justify their costs.

What I learned

The most important thing I learned from this project is that simulating how hedging strategies behave under different price movements is essential to understanding their real impact on the chosen risk profile.

How can it be improved

  • Improve the handling of missing price data and automate the extraction of the risk-free rate.
  • Expand the statistical analysis of assets and incorporate the computation and visualization of the correlation matrix.
  • Extend the Black–Scholes–Merton model to include dividends and variable strike prices.
  • Develop functions to implement and analyze a broader range of option strategies (spreads, straddles, etc.).
  • Compute and visualize the efficient frontier and explore additional risk measures such as Value at Risk (VaR).

Running the project

To run the project, simply open the Jupyter Notebook Option_Pricing_and_Hedging_Strategies_for_Portfolio_Optimization and run all cells.

About

This project analyzes stock market data, implements option pricing models (Binomial Trees, Black-Scholes-Merton and Monte Carlo Simulation), evaluates hedging strategies and constructs an optimized portfolio. It integrates derivative valuation with portfolio analysis to provide insights into risk management and investment decision-making.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors