# Term Structure (Flat)

## Implementation in QFF

A term structure is called flat if the spot rate does not depend on the time-to-maturity.

Let $r(t,T) = \gamma, \gamma \in \mathbb{R}$ for all $T \geq t$. Then we obtain the following interrelation between spot and forward rates:

#### Simple compounding

$\displaystyle{ f_{s}(t, T_{1}, T_{2}) = P(t,T_{1})\left((1 + \tau) \cdot r_{s}(t,T_{2}) - \tau \cdot r_{s}(t,T_{1})\right) = P(t,T_{1}) \gamma_{s} }$

and

$\displaystyle{ f_{s}(t, T) = \lim_{\Delta \to 0} f_{s}(t, T, T + \Delta) = P(t,T) \gamma_{s} }$

#### Periodic compounding

$\displaystyle{f_{1}(t, T_{1}, T_{2}) = \frac{\left(1 + r_{1}(t,T_{2})\right)^{1 + \tau}}{\left(1 + r_{1}(t,T_{1}) \right)^{\tau}} - 1 } = \gamma_{1}$

and

$\displaystyle{ f_{1}(t, T) = \lim_{\Delta \to 0} f_{1}(t, T, T + \Delta) = \gamma_{1} }$

#### Continuous compounding

$\displaystyle{ f_{c}(t, T_{1}, T_{2}) = (1 + \tau) \cdot r_{c}(t,T_{2}) - \tau \cdot r_{c}(t,T_{1}) = \gamma_{c} }$

and

$\displaystyle{ f_{c}(t, T) = \lim_{\Delta \to 0} f_{c}(t, T, T + \Delta) = \gamma_{c} }$

#### Interrelation between instantaneous rates of different compounding methods

Let $r_{s}(t,T) := \gamma_{s}$ and $r_{c}(t,T) := \gamma_{c}$. Then the price of a zerobond can be represented in two ways:

$\displaystyle{ P(t,T) = \frac{1}{1 + \gamma_{s} (T - t)} = \exp(-\gamma_{c} (T - t)) } \,.$

In the article on forward rates it is shown that the following relations are valid,

$\displaystyle{ f_{s}(t,T) = -\frac{\partial \ln(P(t,T))}{\partial T} = f_{c}(t,T) } \,.$

This is satisfied, since

$\displaystyle{ f_{s}(t,T) = P(t,T)\gamma_{s} = \gamma_{c} = f_{c}(t,T) } \,.$

## CodeBook

The flat term structure model is the simplest representation of a real market term structure.

double spot_rate = 0.05;
ILevelTermStructure flat_ts = new FlatTS(spot_rate);