# Spot Rate

## Definition

A spot rate is the internal rate or yield to maturity of a zerobond.

## Compounding

The level of a spot rate does not only depend on the price of the corresponding zerobond but also on the compounding method. The following subsections show the interrelation between the price $P(t,T)$ of a zerobond at time $t$ with maturity $T$, the spot rate $r(t,T)$ for the same period and the compounding method.

#### Simple compounding

The simply compounded spot rate $r_{s}(t,T)$ is implicitly defined by

$\displaystyle{P(t,T) = \frac{1}{1 + (T-t)r_{s}(t,T)}}$

or equivalently,

$\displaystyle{r_{s}(t,T) = \frac{1}{T-t} \left(\frac{1}{P(t,T)} - 1 \right) \,.}$

#### Periodic compounding

The 1-period-compounded spot rate $r_{1}(t,T)$ is given by

$\displaystyle{P(t,T) = \left(\frac{1}{1 + r_{1}(t,T)}\right)^{T-t} }$

with the explicit representation

$\displaystyle{r_{1}(t,T) = \left(\frac{1}{P(t,T)}\right)^{\frac{1}{T-t}} - 1 \,.}$

#### Continuous compounding

Finally, we define the continuously compounded spot rate $r_{c}$ as the interest rate satifying the following equation

$\displaystyle{P(t,T) = 1 \cdot e^{-r_{c}(t,T) (T-t)} \,.}$

Thus, $r_{c}(t,T)$ is given by

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

## Codebook

### Construction

A spot rate is generated with a 3-place factory method create(double level, double ttm, Compounding compounding) in the class InterestRate, where ttm stands for the time-to-maturity:

IInterestRate spot_rate = InterestRate.create(0.04, 0.25, Compounding.CONTINUOUS);