A Python module to price a Euroepan call option at t=0 by Monte Carlo simulation, which is benchmarked against Black Schoels formula.
- Simulates stock prices following a geometric Brownian motion
- Calculates payoffs at t=T and averages the paths
- Discounts the resut to t=0
-
Clone the repository:
git clone https://github.com/hb84ffm/monte-carlo-call-option-pricing.git
cd monte-carlo-call-option-pricing -
Create & activate your virtual environment:
python3 -m venv venv
source venv/bin/activate # On Mac/Linux
venv\Scripts\activate # On Windows -
Install dependencies:
pip install -r requirements.txt
- Instantiate class CallPriceEU with attributes
CallPriceEU(S0=start_stock_price, K=strike, r=rate, sigma=volatility, T=timeframe, samples=nr_of_iterations) - Apply method run() afterwards, which orchestrates the simulation and plotting of the two bar charts
See provided Jupyter notebook example for explanation.
For questions or feedback reach out to me via: GitHub.