# Recursion - 016 - Pure, Functional, Financial, Python Katas

The next kata is the extend the previous day's binary option one period model to a multiperiod one.

For example two period's equations will look something like this in pseudo code

```
C_0 = math.exp(-R * (T/2)) * (P * C_U + (1 - P) * C_D)
```

and `C_D`

looks like

```
C_D = math.exp(-R * (T/2)) * (P * C_DU + (1 - P) * C_DD)
```

`C_U`

is,

```
C_U = math.exp(-R * (T/2)) * (P * C_UU + (1 - P) * C_UD)
```

In this case, `C_UU`

, `C_UD`

, `C_DU`

and `C_DD`

are all known possible terminal values, just as `C_U`

and `C_D`

were in the previous kata.

If we needed to we could extend to as many periods as needed with the same pattern.

When we shuffle the above together, `C_0`

becomes,

```
C_0 = math.exp( -R * (T/2) ) * ( P^2 * C_UU + P * (1-P) * C_UD + (1 - P)^2 * C_DD + (1-P) * P * C_DU )
```

The exercise today, is to recursively generate these binomial trees for any number of periods, just using lambdas.