You are on page 1of 1

Stochastic Differential Equations and Interest Rate Models

Group Project
15 February 2007

On the website you will find a Zip file containing the code for the trinomial tree implementation of the Hull-White model, together with a speadsheet giving yield curve data. At the
moment, the code does the calibration and computes ZC bond values p(0, t) for t = k. It
has an extremely primitive Discount class which just takes a scalar parameter r and returns
p(0, t) = ert . Your tasks are as follows.
Task 1. Rewrite the Discount class so that it reads in a table such as the one on the spreadsheet,
which contains a list, of arbitrary length, of times in years and discount factors expressed as
continuously-compounding zero-coupon yields. The function B is to return the discount factor
for an arbitrary time, by linear interpolation of the yields. You need to write another exported
discount factor function as well, for test purposes.
Task 2. Write an exported swaption pricing function. The function header will be
DOUBLE Swaption(long payer, long T0, long Tswap, long freq, double K, long ppy,
double sig, double lam, double* YieldCurveData)
Here payer=1 for a payers swaption, payer=0 for a receivers swaption, T0 is the start
time (in integer numbers of years) of the underlying swap, Tswap is the length of the swap once
entered (so the last payment date is T0+Tswap), K is the strike (the fixed side rate in the swap)
and YieldCurveData is a 1-dimensional array containg the data in the yield curve table. The
function Swaption will act in the same way as the function ZCB in the present codei.e., it will
declare an instance of class Tree and call a swaption pricing function written within that class.
Task 3. Write a Visual Basic function VBSwaption which calls the C++ Swaption function,
so that you can do swaption pricing on the spreadsheet. Calculate the value of a 3 into 5
payers swaption (i.e. T0=3, Tswap=5) with K=3.3% and semi-annual coupon dates (the accrual
convention is i = 0.5 for all i). Use the data on the spreadsheet, and take = 0.012, = 0.05.
Task 4. As we showed in class, in the Hull-White model we can express the option price
P
analytically by decomposing the strike into K = i Ki and using the Black forward option
pricing formula. The data required is , and the discount factor p(0, tk ) for every coupon date
tk . The latter you can get from the discount function you have already written. Now do the
calculation and compare the answer with what you get from the tree. [You can organize this
computation any way you like: write more C++ code, do it in Excel with a bit of VB, or do an
entirely separate calculation in, say, Matlab. Its up to you.]
The deadline for completing this project is 12 noon, Monday 5 March. Each group should
email should email me a Zip file (called Group n.zip where n is the group number) containing
your complete C++ project, the spreadsheet with the new VB functions included, and a short
reportone or two pages at most, in Word or Latexstating what youve done (I dont need
to know who did what), giving the Swaption price requested above, the calculations for Task 4,
and any comments or observations you want to make.
1