This example is from the sample programs in Python discussed earlier. The notebook shows how to use the ipyparallel package to do Monte-Carlo options pricing in parallel. The notebook computes the price of a large number of options for different strike prices and volatilities.
To save space, only the first several lines of code are given here:
%matplotlib inline import matplotlib.pyplot as plt import sys import time from ipyparallel import Client import numpy as np price = 100.0 # Initial price rate = 0.05 # Interest rate days = 260 # Days to expiration paths = 10000 # Number of MC paths n_strikes = 6 # Number of strike values min_strike = 90.0 # Min strike price max_strike = 110.0 # Max strike price n_sigmas ...