R Python

Python with Reticulate

Let’s download some packages. And calculate European call. import math import numpy as np from timeit import default_timer as timer start = timer() S = 100 K = 105 T = 1 r = 0.05 sigma = 0.2 I = 100000 z = np.random.standard_normal(I) ST = S * np.exp((r-0.5*sigma**2)*T + sigma * math.sqrt(T)*z) hT = np.maximum(ST - K, 0) C0 = math.exp(-r*T)*np.mean(hT) print('Value of %5.3f.' % C0) ## Value of 8.