## Pages

### Basic Math - Big Impact

In today’s blog I am going to give you some insight on how the development of the UnRisk pricing routines works.
Some years ago one of our customers asked for an UnRisk function to price a bond having the following coupon structure (Example 1):

If the EURCMS10Y is bigger than the EURCMS2Y, then 8*(EURCMS10Y-EURCMS2Y) is paid (with a floor of 0%), otherwise the instrument pays a fix coupon of 4%
We developed functions to price such a product (under LMM and under Hull & White 2 factor) by implementing the following coupon logic (in the example RefRate1 is the EURCMS10Y and RefRate2 is the EURCMS2Y):

(1)    Condition:
RefRate1 – Refrate2  > 0
(2)    Branch 1 (if Condition is fulfilled):
Coupon Rate = 8*(RefRate1 - RefRate2), Floor = 0%
(3)    Branch 2 (if Condition is not fulfilled):
Coupon Rate = 4%
Some weeks after we had finished these developments, another customer came up with the following coupon structure (Example 2):
The coupon rate is given by 8*(EURCMS10Y-EURCMS2Y) capped with the EURCMS10Y (again, with a floor of 0%)
This can be written as
(4)    Min(8*(EURCMS10Y-EURCMS2Y),EURCMS10Y), Floor = 0%
So we were thinking on how to incorporate this instrument into our framwork. We came to the following conclusion (again, we use the variables RefRate1 and RefRate2 for the two EURCMS rates):
(5)    Condition:
RefRate1 > 8*(RefRate1-RefRate2)
Which can be written as (this is the simple math part):
(6)    Condition:
-7*RefRate1 + 8*RefRate2  >  0
(7)    Branch 1 (if Condition is fulfilled):
Coupon Rate = 8*(RefRate1 – RefRate2) , Floor = 0%
(8)    Branch 2 (if Condition is not fulfilled):
Coupon Rate = RefRate1 , Floor = 0%
In order to enable us to cover both instruments by the same pricing function and to prevent us from new implementations if another customer comes with a similar problem, we extended our first pricing function to cover the following coupon structure (x1, y1, z1, x2, y2, c2, f2, x3, y3, c3 and f3 are numbers):
(9)    Condition:
x1*RefRate1 + y1*RefRate2 > z1
(10) Branch 1 (if Condition is fulfilled):
Coupon Rate = x2*RefRate1 + y2 * RefRate2 , with Cap c2 and Floor f2
(11) Branch 2 (if Condition is not fulfilled):
Coupon Rate = x3*RefRate1 + y3*RefRate2, with Cap c3 and Floor f3
Within the UnRisk world we gave an instrument having such a coupon structure the name „Steepener Type 2“.
At the end I am going to explain how the mentioned examples may be set up as Steepener Type 2.
Example 1 (x3 and y3 may be set to any number, e.g. , 1):
(12) Condition:         x1 = 1 , y1 = 1 , z1 = 0
(13) Branch 1:           x2 = 8 , y2 = -8 , c2 = 1000 , f2 = 0
(14) Branch 2:           x3 = 1 , y3 = 1 , c3 = 4% , f3 = 4%
Example 2:
(15) Condition:         x1 = -7 , y1 = 8 , z1 = 0
(16) Branch 1:           x2 = 8 , y2 = -8 , c2 = 1000 , f2 = 0
(17) Branch 2:           x3 = 1 , y3 = 0 , c3 = 1000 , f3 = 0
By using some variables and applying basic math we have developed a very mighty function for pricing instruments fitting into our „Steepener Type 2 framework“. Many of the UnRisk users price instruments fitting (and there are many of them) into this framework by the use of one single pricing function.