# G2 Model¶

## Overview¶

In mathematical finance, the Two-additive-factor gaussian (G2) model draws the evolution of interest rates. It is a “two factor model” compared with other single factor models, as it describes interest rate movements that driven by only one source of market risk. Moreover, it can be used to evaluate interest rate derivatives.

## Implementation¶

This section mainly introduces the implementation process of short-rate and discount, which is applied in Tree/Finite-difference Engine. They are core part for option pricing.

The class $$G2Model$$ implements the two-factor model to calculate short-rate and discount. The implementation process is introduced as follows:

1. Function treeShortRate: a) Since the short-rate at the current time point is independent from the short-rate at the previous time point, there is no need to calculate the short-rate in this module. b) To be compatible with the generic Tree framework, this model performs the calculation of parameters of 2 independent trinomial trees.
2. Function shortRate: The short-rate is calculated at time point $$t$$.
3. Function discount: The discount is calculated at time point $$t$$ with the duration $$dt$$ by function discount based on the short-rate.
4. Function discountBond: the discount bond is calculated at time point $$t$$ with the duration $$dt=T-t$$ based on the short-rate.