# Internal Design of MCEuropeanHestonGreeksEngine¶

## Overview¶

Greeks is often used to measure the sensitivity of the derivative values to changes in the behavior of the underlying instruments from which they are derived as well as changes in the broader market, such as shifts in interest rates (from STAC-A2).

The derivative value $$X(t)$$ often is affected by the initial stock price, volatility, risk-free rate and mature date. For different sensitivity, there are different Greek alphabet. The following are some common sensitivities for option.

$\delta:\frac{\partial X_t}{\partial S}$
$\gamma:\frac{\partial^2 X_t}{\partial S^2}$

Both $$\delta$$ and $$\gamma$$ measures the impact of price changes on option price.

$\theta:\frac{\partial X_t}{\partial t}$

$$\theta$$ measures the change of option price over mature time.

$\rho:\frac{\partial X_t}{\partial r}$

$$\rho$$ measure the impact of risk-free interest rate on option price.

$vega:\frac{\partial X_t}{\partial \sigma}$

$$vega$$ measure the impact of volatility on option price. Actually, the volatility changes over time. So, that means the option price will change over mature time.

There are also some model specific sensitivities. For Heston model, the model parameter $$\kappa$$ (mean reversion), $$\theta$$ (long term variance) and $$\xi$$ (volatility of volatility). These model parameter will affect the volatility of underlying price, and then indirectly affect the option price. To measure the sensitivity of option price to model parameter, the following model vega are defined:

$modelVega_0 = \frac{\partial X_t}{\partial \kappa}$
$modleVega_1 = \frac{\partial X_t}{\partial \theta}$
$modelVega_2 = \frac{\partial X_t}{\partial \xi}$

## Implementation¶

The numerical method for Greeks calculation includes finite difference, pathwise and likelihood ratio.

In our implementation, we use the finite difference method to calculate Greeks. Finite difference methods use the following differential expression to approximate partition derivative.

$\delta = \frac{X(t, S_t + h, r, \sigma) - X(t, S_t, r, \sigma)} {h}$

When any of the parameter changes, MCEuropeanHestonEngine will be called once to calculate the option price.