# MATLAB code for implementing Algorithm 2 in the paper "Unified moment-based modelling of integrated stochastic processes" by Kyriakou, Brignone and Fusai 

This MATLAB code allows to simulate the asset price in the Heston model.
The variable notation is sligthly changed compared to the paper to improve readability of the code. However, it should be fairly straightforward to communicate between the two.

Requirements
--------------
The code is written and tested for MATLAB R2019b and makes use of the optimization, statistics and symbolic toolboxes.

Main script file
--------------
This is the main script file that implements the algorithm.
**main.m** Initializes the simulation in the Heston model and pricing of ATM European call options for the parameter sets reported in the paper. It also compares with the true option price.

Connected files
--------------
**Algorithm1.m** Implements Algorithm 1 in the paper to compute fast the moments of the conditional distribution.
**getCondmgfBK.m** Evaluates the conditional moment generating function of the integrated variance in the Heston model.
**pearsrndVect.m** Generates random numbers from a 4-moment fitted Pearson distribution (this is a vectorized version of the built-in function "pearsrnd").
**simHeston.m** Simulates transitions in the Heston model using Algorithm 2 in the paper.
