Skip to content
@Bellcrve

Bellcrve

Bellcrve - A Distributed Computing of the Monte Carlo Simulation on Options Pricing

The Monte Carlo Simulation is a stochastic method that relies on random sampling to solve problems that might be deterministic in nature. Here we use the Monte Carlo Method to price options of a financial instrument by simulating various future paths and averaging the discounted payoff. This is useful when pricing complex derivatives where close-formed solutions are not available.

The goal of this research is to distribute $\approx$ 10,000 Monte Carlo simulations across 10 virtual machines where each machine handles 1,000 simulations each to speed up computation time.

We define variables:

$$ let \begin{cases} r &= \text{Risk-free interest} \\ S_{0} &= \text{Current stock price} \\ Z &\sim \mathcal{N}(0, 1) \\ \Delta t &= \text{Time increment} \\ \sigma &= \text{Volatility} \\ K &= \text{Strike price} \\ T &= \text{Expiration date}\\ \end{cases} $$

Geometric Brownian Motion

First, we introduce the notion for the Geometric Brownian Motion widely used for modeling the assets price path over the simulation. We start the simulation at the stocks current price point, and observe how it changes as the number of steps increases. We sample a random gaussian variable $Z$ from $\mathcal{N}(0,1)$. $\$
$S_{t}+\Delta t = S_{t-1} \cdot \exp\left( (r - \frac{\sigma^{2}}{2}) \cdot \Delta t + \sigma \cdot \sqrt{\Delta t} \cdot Z \right)$ $\\$

where $\Delta t$ = $\frac{\text{time to expiration}}{\text{Steps}}$

We are interested in observing the payoff of the stock over the time interval as the assets price changes over the number of steps.

Black Scholes Model

We then introduce the Black Scholes Model widely used for pricing stocks based on their volatility and time with respect to calculating the theoretical options price.

$$ cost_{call} = S_0 \cdot N(d_1) - K \cdot e^{-rT} \cdot N(d_2) $$

$$ cost_{put} = K \cdot e^{-rT} \cdot N(-d_2) - S_0 \cdot N(-d_1) $$

Where ( N ) is the Gaussian CDF, and cost represents the theoretical option price.

So, let us define:

$$ d_1 = \frac{\ln\left(\frac{S_0}{K}\right) + \left( r + \frac{\sigma^2}{2} \right)T}{\sigma \sqrt{T}} $$

$$ d_2 = d_1 - \sigma\sqrt{T} $$ where $d_1$ measures how far in the money a stock is considering the expected growth and the volatility, and where $d_2$ represents the effect of volatility and time decay. $d_2$

Cost Function

We then calculate the error to view how accurate our simulation was. We take the absolute difference between the GBM price and the Black Scholes price to approximate the theoretical value. Ideally, we are looking for the error to be small, meaning our simulation is producing results close to the expected theoretical price. The error indicates to us whether the GBM converges to the Black Scholes model as we increase the number of simulations.

$$ error = | \text{GBM Simulated Price} - \text{Black Scholes Price} | $$

Distributed Computing Architecture

We hosted 10 VM's in digital oceans ecosystem, where 1 is the Master Node, 8 are worker nodes, and 1 is the scheduler. We then distributed 10,000 simulations across the 8 worker nodes and found that as our simulation converged

Misc

The math behind this project is bundled into a package on Pypi and installation instructions can be found here

Try out our application here

Pinned Loading

  1. distributed-monte-carlo-backend distributed-monte-carlo-backend Public

    Python

  2. MonteMath MonteMath Public

    Math for Monte Carlo simulation using Geometric Brownian Motion and Black Scholes Model

    Python

  3. dashboard dashboard Public

    TypeScript

Repositories

Showing 4 of 4 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…