- We start with the assumption that underlying follow Geometric Brownian Motion (GBM):
- We use Ito’s Lemma with , then we have
By Ito’s Lemma, we have
- Therefore, the change of between time 0 and future time T, is normally distributed as following:
is the noise term from standard normal distribution.
Note, we will take , which is the risk free rate. This means investors are risk neutral and requires risk free return on underlying asset. This is to be consistent with the risk neutral probabilities used in simulation.
Correspondingly, we also use risk free rate in the discount factor in step 5.
- So now we can simulate the future underlying price at expiry. With European Call or Put boundary condition to calculate the payoff.
- We then need to discount the future payoff back to present by multiplying a discount factor,
- The above two steps are repeated many times and its expectation is calculated as the final simulation result.
def getMCPrice(self): """ Determine the option price using a Monte Carlo approach. The log return of underlying follow Normal distribution. s_T = s_t * exp((r - 1/2 * sig^2) * (T-t) + sig * sqrt(T-t) * sig_Normal) """ calc = np.zeros([self.iterations, 2]) rand = np.random.normal(0, 1, [1, self.iterations]) mult = self.spot * np.exp(self.tenor * (self.rate - 0.5 * self.sigma**2)) if self.callPut == 'Call': calc[:,1] = mult * np.exp(np.sqrt((self.sigma**2)*self.tenor) * rand) - self.strike elif self.callPut == 'Put': calc[:,1] = self.strike - mult*np.exp(np.sqrt((self.sigma**2) * self.tenor) * rand) avgPayOff = np.sum(np.amax(calc, axis=1)) / float(self.iterations) return np.exp(-self.rate * self.tenor) * avgPayOff def getBSPrice(self): """ Determine the option price using the exact Black-Scholes expression. """ return blackScholesOptionPrice(self.callPut, self.spot, self.strike, self.tenor, self.rate, self.sigma)
from option_pricer import EuropeanVanillaPricer pricer = EuropeanVanillaPricer() pricer.getMCPrice() 2.1620364099067015 pricer.getBSPrice() 2.1736062697012564
Alternatively, we can use random numbers from a Uniform distribution, i.e. equal probability of each random number.