Python for Finance: Analyze Big Financial Data

(Elle) #1

Notebook dashboard. The number of threads to be used of course depends on the machine


and the processor you are running your code on. Figure 8-2 shows the IPython page for


starting a cluster.


Figure 8-2. Screenshot of IPython cluster page

IPython.parallel needs the information on which cluster to use for the parallel


execution of code. In this case, the cluster profile is stored in the “default” profile. In


addition, we need to generate a view on the cluster:


In  [ 39 ]: from IPython.parallel import Client
c = Client(profile=“default”)
view = c.load_balanced_view()

The function implementing the parallel valuation of the options looks rather similar to the


sequential implementation:


In  [ 40 ]: def par_value(n):
”’ Parallel option valuation.

                                                    Parameters
==========
n : int
Free download pdf