Monte Carlo Options Pricing in Two Lines of Python

AI, Quantitative Analysis and Data Science Solutions for Finance and Manufacturing.

Monte Carlo Options Pricing in Two Lines of Python

September 1, 2017 Uncategorized 0

This is an old video that I produced sitting on my bed in the morning in order to learn how to make basic Youtube videos. Nevertheless, I became quite popular. I apologise for looking a bit rough. Hope you enjoy it regardless.

Here is the code:

from numpy import cumprod, random, sqrt, mean
k = cumprod(1+random.randn(10000,252)*0.2/sqrt(252),1)*100
mean((k[:,-1]-100)*((k[:,-1]-100)>0))

If that seems a bit complex, check out the video for an explanation how the code works.