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.
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.
- CPU : Intel(R) Core(TM) i5-6400 @ 2.7GHZ
- RAM : DDR3L 16GB PC3-12800
- Python 2.7, numpy 1.10.4
- 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) |
- If you're interested in my works, please email me.