/monte_calro_python

Monte Carlo simulation using Python

Primary LanguagePythonMIT LicenseMIT

Monte Carlo simulation using Python

Introduction

Here is an implementation of Monte Carlo simulation(MCS) for pricing derivatives using Python. Not only general method for MCS but also vectorization codes are tested.

The main purpose is to introduce the MCS for finance. All of programs in this repe are performed by Python.

Methods

As I mentioned in Vectorization repo, the main reason for performance of MCS is loop. Here, I tested the Numpy which is library for linear algebra in Python. Detailed information of Numpy can be found in Numpy-Python.

Environment

Result

  • In this repo, I compare the performance between CPU and GPU. The parameters can be modified freely.
European call Up&out call ELS 1-asset (Price) ELS 2-asset (Price) ELS 3-asset (Price)
General MCS 1.2341s

(106 simuls)

1.7619s

(105 simuls)

11.0568s

(104 simuls)

45.4266s

(104 simuls)

68.9585s

(104 simuls)

Vec MCS 0.0785s

(106 simuls)

N/A 0.6229s

(104 simuls)

1.4709s

(104 simuls)

2.2230s

(104 simuls)

Note

  • If you're interested in my works, please email me.