10.12.2019 Views

Python for Finance

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Monte Carlo Simulation

Efficiency, Quasi-Monte Carlo, and Sobol

sequences

When applying the Monte Carlo simulation to solve various finance-related

problems, a set of random numbers is generated. When the accuracy is very high,

we have to draw a huge amount of such random numbers. For example, when

pricing options, we use very small intervals or a large number of steps to increase

the accuracy of our solutions. Thus, the efficiency of our Monte Carlo simulation

would be a vital issue in terms of computational time and costs. This is especially

true if several thousand options are to be priced. One way to increase the efficiency is

to apply a better algorithm, that is, optimize our codes. Another way is to use some

special types of random numbers that are more evenly distributed. This is called

Quasi-Monte Carlo Simulation. A typical example is a so-called Sobol sequence.

Sobol sequences belong to the so-called low-discrepancy sequences, which satisfy the

properties of random numbers, but are distributed more evenly:

import numpy as np

import matplotlib.pyplot as plt

np.random.seed(12345)

n=200

a = np.random.uniform(size=(n*2))

plt.scatter(a[:n], a[n:])

plt.show()

The related graph is shown on the left panel:

[ 462 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!