Analytic Framework For Implying Yield Curves From Market Data OpenGamma
Analytic Framework For Implying Yield Curves From Market Data OpenGamma
RICHARD WHITE
1. Swap Specifications
For the treatment of swaps within analytics we define the following quantities:
• tf1 ix . . . tfMix is the set of fixed payment times
• tf1 lt . . . tfNlt is the set of floating payment times
• Fi is the reference rate for the floating payment at tfi lt
• αif ix = αf ix (tfi−1 ix f ix
, ti ) is the period (accrual fraction), according to the day count
convention, between fixed payments i − 1 and i
• αif lt = αf lt (tfi−1 lt
, tfi lt ) is the period (accrual fraction), according to the day count
convention, between floating payments i − 1 and i
• αiF is the accrual fraction for reference rate Fi
• ∆si is the difference between the start (effective or fixing) time of Fi and tfi−1 lt
• ∆ei is the difference between the end (maturity) time of Fi and tfi lt
• pf und (T ) is the funding discount curve
All times are expressed in years (i.e 0.5 is half a year). tf0 lt is taken as the effective
(start) date of the swap (not a payment date), which is usually two days after the trade
date. Also, one would expect the start date of some reference rate to be the same as the
end date of the previous reference rate, i.e. ∆si+1 = ∆ei which are typically of order a
few days.
The present value of the fixed leg is
M
kαif ix pf und (tfi ix )
X
(1) P V (fixed) =
i=1
N
Fi αif lt pf und (tfi lt )
X
(2) P V (float) =
i=1
Date: First version: September 21, 2011; this version March 30, 2012.
Version 1.0.
1
2 RICHARD WHITE
A par swap has a swap rate such that its PV is zero. With this condition, the par-swap
rate is
Fi αif lt pf und (tfi lt )
PN
(4) k = Pi=1
M f ix f und f ix
i=1 αi p (ti )
1.1. Libor Reference Rate. We consider the (usual) case where the reference rate is
Libor (with some tenor). To keep things completely general, we assume that funding is
not at Libor, and we define plibor (T ) as the Libor discount curve. The (forward) Libor
reference rates can be expressed in terms of the discount factors as
plibor (tfi−1
lt
!
1 + ∆si )
(5) Fi = F −1
αi plibor (tfi lt + ∆ei )
with the expression for the par-swap rate becoming
αfi lt plibor (tfi−1
lt
+∆si )
− 1 pf und (tfi lt )
PN
i=1 αF plibor (tfi lt +∆ei )
i
(6) k= PM f ix f und f ix
i=1 αi p (ti )
Almost certainly we have αif lt = αiF , but it is left in the expression for maximum
generality. In the case that all the ∆s are zero and the funding curve is Libor, equation
6 collapses to the usual textbook form
p(tf lt ) − p(tf lt )
(7) k = PM0 f ix Nf ix
i=1 αi p(ti )
In both cases the swap rate is a function of the discount factors (possibly from multiple
curves) at fixed times.
∂k 1 ∂B B ∂A
(8) x
= x
− 2 x
∂p (t) A ∂p (t) A ∂p (t)
where the superscript x indicates with respect to which curve we are taking the de-
rivative. The fixed leg part is
THE ANALYTIC FRAMEWORK FOR IMPLYING YIELD CURVES FROM MARKET DATA 3
(
∂A αkf ix 1(tfk ix − t) if x is the funding curve,
(9) =
∂px (t) 0 ∀t if x is any other curve
where 1(x) is the indicator function which equals 1 if x = 0 and is 0 otherwise. The
most general form of the floating leg is
( f lt
∂B αk Fk 1(tfk lt − t) if x is the funding curve,
(10) = PN ∂Fi f lt f und f lt
∂px (t) i=1 ∂px (t) αi p (ti ) ∀t if x is any other curve
If the reference rate is linked to the funding curve (e.g. the reference is Libor and fund-
ing is at Libor) then both terms in the above equation must be considered. Returning
to the case of a Libor reference rate, we have
" f lt #
∂Fi 1 ∂ p(ti−1 + ∆si )
= F −1
∂p(t) αi ∂p(t) p(tfi lt + ∆ei )
(11)
1(tfi−1
lt
+ ∆si − t) p(tfi−1
lt
+ ∆si )1(tfi lt + ∆ei − t)
= − 2
p(tfi lt + ∆ei )
p(tfi lt + ∆ei )
with p(t) understood to be the discount factors for the Libor curve. Putting this
together with equation 10 we finally have
f lt f und f lt
αk p (tk )
αF libor (tf lt +∆e )
for t = tfk−1
lt
+ ∆sk ,
k p k k
∂B f lt
αk f und (tf lt ) “p
libor (tf lt +∆s )
(12) libor
= − F p k
k−1 k
”2 for t = tfk lt + ∆ek ,
∂p (t) α k p libor f lt e
(tk +∆k )
0 for t taking any other value
It is clear from equation 6 that the swap rate only depends on the values of discount
factors (possibly from multiple curves) at a set of predefined times - the values of the
curve away from these times are irrelevant (hence the indicator function popping up in
the sensitivities).
2.1. Present Value Sensitivity. Using the same notation as above the PV of a payer
swap (i.e. pay the fixed leg) is
(13) P V (payer) = B − kA
so
∂P V ∂B ∂A
(14) x
= x −k x
∂p (t) ∂p (t) ∂p (t)
with of course the sensitivities of the two legs being the same as above.
4 RICHARD WHITE
3.1. The Jacobian. The standard method of inverting the vector equation y = f (x),
when x and y are the same length, is a Newton-Raphson approach which iterates from
some initial guess x0 using
xi+1 = xi − J−1 (f (x) − y)
until xi+1 − xi = 0 or equivalently f (xi ) − y = 0. The jacobian, J is
yields taking the place of of xs. For two curves, e.g. Libor and funding, we arrange the
Jacobian as follows
∂θ ∂θ1 ∂θ1 ∂θ1
1
libor . . . libor f und . . . f und
∂r1 ∂rj ∂r1 ∂rN −j
∂θ2 . . . ∂s2 ∂θ2
. . . ∂θ2
∂r1libor ∂rjlibor ∂r f und
∂r f und
1 N −j
(16) J= .. .. .. ..
.. ..
. . . . . .
∂θ ∂θN ∂θN ∂θN
N
∂rlibor
. . . ∂rlibor f und ... f und
1 j ∂r1 ∂rN −j
with j nodes on the Libor curve and N − j nodes on the funding curve.5
When θ is a PV rather than a rate, the Jacobian provides direct hedging information
- the PV016 of instrument i is just the sum of terms in the ith row (multiplied by
one-thousandth).
3.2. Interpolator Sensitivity. As we have already mentioned, not all of the discount
factors needed to calculate the swap rate can be nodes of the yield curve. This means
we need to know the sensitivity of any point on the interpolated curve to the movement
of the nodes. With this additional information we can form the analytical Jacobian.7
For N nodes (x1 , y1 ), (x2 , y2 ), . . . , (xN , yN ) many interpolators can be written in the
form
X N
(17) y= ai (x)yi
i=1
The sensitivity of interest is
N
∂y X
(18) = ai (x)δi,k = ak (x)
∂yk
i=1
A local interpolator (e.g. linear) will only have sensitivity to the local nodes (i.e. the
nodes k and k + 1 for x ∈ (xk , xk+1 )), while a global method, such as cubic spline, will
have sensitivity to all the nodes - this is an important consideration for hedging. For
an instrument which is sensitive to a set of yields at times t1 , . . . , tM , the sensitivity to
node j is
M
∂θ X ∂r(ti ) ∂θ
(19) =
∂rj ∂rj ∂r(ti )
i=1
We now have all the pieces in place to imply a yield curve(s) - the inputs are the
market instruments (par swaps), the positioning of the yield curve nodes and the choice
of interpolator. The output is the yields at those nodes, which (together with the choice
of interpolator) will exactly recover the swap rates.
5Clearly the vector x has the j nodes of the Libor curve as its first j entries and the N − j nodes of
the funding curves as its remaining entries.
6Strictly PV01 (Present value of a basis point) is the change in PV with respect to a parallel move
of the yield curve by 1 basis point. We have taken the derivative of PV with respect to a parallel shift
of the yield curve scaled to 1 basis point.
7it is possible to obtain the Jacobian using central differencing, which is what we originally did - this
requires 2N calls to f (x).
6 RICHARD WHITE
In order to back out a single curve, the obvious choice of the node positions is at the
last payment time of each of the swaps. If a linear interpolator is used, the Jacobian
will be lower triangular, and the nodes could be found by bootstrapping - the value of
the first node (yield) is chosen to give the correct swap rate for the first swap, with this
fixed the second node is chosen to give the correct rate to the second swap, etc. We
tested the system with a cubic spline, where every node to some extent has an effect on
every swap rate. The system worked well both in an idealised test case8 and using USD
reference par-swap rates from Bloomberg.
It is also possible is recover two curves (funding and Libor) from the swap rates. The
nodes cannot be placed at the last payment times of the swaps, but instead must be
divided up between the two curves. The sensitivity of the swap rates to the funding curve
only is small (that part of the Jacobian has much smaller values than the Libor part),
and while for an idealised test case both curves can be recovered, there is no guarantee
that a root even exists with market data. In practice, additional instruments are used
(cash rates, FRAs, futures, basis swaps) to give the required sensitivity to various curves
(and particular time periods on those curves). This is dealt with in the next section.
(L(tf , tm ) − k)α
(20) payment at settlement =
1 + τ L(tf , tm )
where the year fraction to calculate the payment (α) and that used to calculate the
discount (τ ) are not necessarily the same. The PV of this instrument is given by
R
P − 0ts rt dt (L(tf , tm ) − k)α
(21) PV = E e
1 + τ L(tf , tm )
where rt is the funding rate. If funding was at Libor, we can change numeraire to the
zero coupon bond maturing at tm and the above expression becomes
P V = plibor (tm )ET [(L(tf , tm ) − k)α]
(22)
= plibor (tf ) − (1 + αk)plibor (tm )
since
plibor (tf )
T 1
(23) E [L(tf , tm )] = F (tf , tm ) = −1
α plibor (tm )
which is also the strike, k, that makes the FRA fair (zero PV).
8We constructed a dummy curve, got swap rates off it for USD 6m, 1y, 2y, 3y, 5y, 7y, 10y, 15y, 20y,
25y & 30y, then used these rates to recover the curve
THE ANALYTIC FRAMEWORK FOR IMPLYING YIELD CURVES FROM MARKET DATA 7
In the absence of a model for the joint dynamics of the forward and funding rates, we
assume the PV to be given by
f und (F (tf , tm ) − k)α
(24) PV = p (ts )
1 + τ F (tf , tm )
For a fair FRA, the sensitivities of the strike purely to the Libor curve given by
1 1
α plibor (tm ) for t = tf ,
∂k
plibor (t )
(25) libor
= − α1 libor f 2 for t = tm ,
∂p (t)
(p (tm ))
0 for t taking any other value
4.2. Futures. Futures are traded based on price. The price implies a forward rate given
by F = 1 − price
100 , which is usually 3-month Libor with fixing date the third Wednesday
of the contract month. The sensitivity of the implied rate can be treated the same as
FRAs above (i.e. we do not apply any convexity adjustment).
No money is paid up front for a future. For a tenor of α, if the price rises by ∆
(implying a fall in the forward rate of ∆/100) , there is an immediate profit (paid into a
margin account) of N ∆α/100 where N is the notional of one contract.9 So the PV can
be written in terms of the current implied forward, F (ts , tm ), and the price of the future
when the contact was entered, c.
c
(28) P V = αN 1 − F (ts , tm ) −
100
Then
∂P V ∂F
(29) = −αN libor
∂plibor (t) ∂p (t)
∂F
where again ∂p(t) is given by equation 11. So a future has the opposite sign of PV sensi-
tivity to a FRA, and also no sensitivity to the funding curve due to mark-to-marketing.
9For Eurodollar futures α is 0.25 (i.e 90/360) and the notional is $1M so a 1bp fall in the forward
rate gives a gain of $25. The minimum change of value (tick) is $12.50 or 0.5 bps
8 RICHARD WHITE
4.3. Spot Libor. Today’s Libor (set at 11am) is available for a range of tenors (1
month, 2 months and 3 months being the most liquid). To be completely consistent
when building a Libor curve, we should only use the tenor used in the swaps and FRAs
(3 months for USD swaps and FRAs). In the Opengamma system, spot Libor is treated
as a FRA with fixing date and settlement date equal to the trade date, which is normally
2 days from now.
4.4. Cash. Short term cash deposits (i.e. O/N, 1W, 2W etc) which use simple interest
can be treated as spot Libor above, but with sensitivity to the funding curve (assuming
cash rates represent short term funding costs).
4.5. Floating Rate Notes (FRN). FRNs are bonds that pay a variable coupon based
on a reference rate plus a spread. The notional is paid up front and returned at maturity.
Using the same notation as for swaps, the present value (with unit notional) is:
N
X
(30) P V = −pf und (t0 ) + pf und (tN ) + (Fi + s)αi pf und (ti )
i=1
where t0 is the trade time (which may be zero) and s is the spread. If funding is at
Libor, with a zero spread the PV is zero - FRNs are always at par when funding at the
reference rate.10 To trade at par for any other funding requires a spread of
pf und (t0 ) − pf und (tN ) − N f und (t )
P
i=1 Fi αi p i
(31) s= PN f und
i=1 αi p (ti )
which will be negative if one can fund at less than Libor (e.g. by posting collateral).
The sensitivity of this spread and the PV to the curves will follow through as for swaps.
4.6. Basis Swaps. Basis swaps are float for float with each leg based on a different
reference rate (interest-rate indices), with one leg typically paying a (fixed) spread.
4.6.1. Basis Swap in a Single Currency. A basis swap exchanges payments based on one
index (e.g. Fed-Funds) for another (e.g. 3m-Libor) on the same notional amount. A
tenor swap exchanges payments based on different Libor tenors, e.g. 3 month Libor paid
quarterly for 6 month Libor paid semi-annually.
If legs of the swap (a and b) have reference rates, F a and F b , the PV of the receiver
of leg a is
M
X N
X
(32) PV = Fia αia pf und (tai ) − (Fib + s)αib pf und (tbi )
i=1 i=1
where s is the spread, which in this set up can take positive or negative values. Making
the PV zero, the spread becomes
PM a a f und (ta ) −
PN
i=1 Fi αi p i Fib αib pf und (tbi )
(33) s= PN b f undi=1b
i=1 αi p (ti )
which is just equation 6 for the par swap rate, with Fi = (Fia − Fib ). In the general case,
we again let the spread s = B/A and proceed as in section 2
(
∂A αkb 1(tbk − t) if x is the funding curve,
(35) =
∂px (t) 0 ∀t if x is any other curve
a a t = tak ,
∂B αk Fk
(36) b
= −αk Fk b t = tbk ,
∂pf und (t)
0 any other t
M
X ∂F a n
X ∂F b
∂B a f und a
(37) = i
αi p (t i ) − i
αb pf und (tbi )
∂px (t) ∂px (t) ∂px (t) i
i=1 i=1
∂Fia
If the reference rates are Libor (with different tenors) then terms like ∂px (t) are given by
equation 11. The PV sensitivity is similarly calculated.
Example: Implying two curves - 3m Libor and Fed-Funds. A general tenor swap will have
sensitivity to three curves.11 To back out a Libor (e.g. 3m) and funding (e.g. Fed-Funds)
curve, we could consider a set of N collateralized swaps (so funding is at Fed-Funds),
and a set of M collateralized Fed-Funds vs 3m Libor tenor swaps (again funding at Fed-
Funds) - the swaps are mostly sensitive to the Libor curve, so the N nodes on this curve
should be at the swap maturities, while the FRNs are mainly sensitive to the spread
between the Libor and Fed-fund curve, in which case the M nodes of the funding curve
should be at the maturity of the FRNs. This treats both curves on an equal footing.
An alternative is to have a primary Libor curve and a spread curve (funding is Libor -
spread) - the Libor curve could use more than N nodes, with the remainder going to
spread curve.12
curve are the same for one leg, we can treat the other leg as a FRA provided it is the
one that the spread is paid on.
Let pd (t) and pf (t) be domestic and foreign discount factors for the respective funding
curves and Fid and Fif be the domestic and foreign index rates which are paid at times
td1 . . . tdN d and tf1 . . . tfN f . The PV on the domestic side (i.e. paying the domestic index
rate plus spread and receiving the foreign) for unit notional is:
Nf
x(t0 ) f
−p (t0 ) + pf (tfN f ) + Fif αif pf (tfi )
X
PV =
x(0)
i=1
(38)
Nd
X
− −pd (t0 ) + pd (tdN d ) + (Fid + s)αid pd (tdi )
i=1
The PV (and equivalently the spread) is sensitive to (up to) four curves13 - these sensi-
tivities (and that for the spread) can be calculated in the same manner as the previous
sections.
Discussion. The tenors used in CCS do not necessarily match those of interest rate swaps
(IRS), so one could easily be in a situation of needing strips of foreign and domestic IRSs
(plus other instruments to take care of the short end of the curve), strips of overnight
rates versus Libor basis swaps, Libor tenor swaps, and CCSs. In this situation one would
most likely want base curves of the foreign and domestic funding rates, with other curves
implemented as spreads over these curves.
5. Hedging
Let x1 . . . xN be the PV of the instruments14 used to build the curve(s), and r1 . . . rN
be the yields at the node points on the curve(s)15. The Jacobian is as usual
∂x1 ∂x1
∂r1 . . . ∂r N
(40) J = ... .. ..
. .
∂xN ∂xN
∂r1 ... ∂rN
13those are the funding in both currencies, and the Libors in both currencies
14we will use x to refer to both an instrument and its price
i
15the distinction between one and many curves is not relevant here, so we will just talk about the
yields ri which could refer to one or many curves
THE ANALYTIC FRAMEWORK FOR IMPLYING YIELD CURVES FROM MARKET DATA 11
The sensitivity of the instruments to a parallel movement in the curve is given by sum-
ming each row. Mathematically this is
1
∂x ..
|parallel move = J1 where 1 = .
∂r
1
Sensitivities to other deformations of the curve can be found by replacing the vector 1
with one describing the appropriate deformation (e.g. steepening of the curve).
5.1. Delta Hedging a Curve Sensitive Instrument. Let y be some other instrument
whose price depends purely on the curve we have implied from the N instruments xi
above. A portfolio can be formed thus:
N
X
(41) Π=y− wi x i
i=1
where the weights wi are the amounts held of xi (hold one unit of y). To be insensitive
to any small movement of the curve requires
N
∂Π ∂y X ∂xi
(42) =0 ⇒ = wi ∀k
∂rk ∂rk ∂rk
i=0
gives
T
(44) y 0 = JT w ⇒ w = J−1 y0
In general, every entry in w will have a non-zero value, implying some position will need
to be taken in every instrument. Furthermore, there is no guarantee that the weights will
not contain large positive and negative values17, making the hedge extremely sensitive
to non-negligible movements of the curve (i.e large gamma). In practice one wants to
pick a few hedging instruments that are sensitive to the curve and match the properties
of y (e.g. similar maturity, etc). Let the M instruments be h1 . . . hM , and again form a
portfolio
M
X
(45) Π=y− wi hi
i=1
16The quantities ∂y
are calculated by the system exactly as the entries in the Jacobian are
∂rk
17this is often seen in mean-variance portfolio optimisation, where mathematically the equation for
the weights is the same
12 RICHARD WHITE
∂Π
With M < N it is not possible to meet the condition ∂r k
= 0 for all k. We define the
sensitivity matrix H and the vector of small movements of the yields, ∆r as
∂h1 ∂h1
∂r1 . . . ∂r N
∆r1
(46) H = ... .. .. ∆r = ..
. . .
∂hM ∂hM ∆rN
∂r1 ... ∂rN
so a small change in the value of the portfolio can be written as
(47) ∆Π ≈ −∆r · (HT w − y0 )
This is a random variable, which depends on the random vector ∆r. To keep things
tractable we aim to minimise the expectation of the square of this value:
E[∆Π2 ] = (HT w − y0 )T Θ(HT w − y0 )
(48)
where Θ = E[∆r∆rT ]
So Θ should be available from time series data of the changes in the yields - if E[∆Π] = 0
(i.e. there is no drift), then Θ is the covariance matrix of changes in yields. Differenti-
ating with respect to the weights we have
∂E[∆Π2 ]
=0⇒
∂w
(49) HT ΘHw = HT Θy0 ⇒
w = (HT ΘH)−1 HT Θy0
This will in general give a more robust hedge to movements of the curve.
6. Conclusion
Any interest rate product with price sensitivity to a set (possibly only one) of yield
curves only, can be used to imply these curves provided one can write down a function
from yield curves to price. If, when attempting to imply several curves, there are no
instruments that are sensitive to all the curves, then the problem decouples and the
different curves can be found separately.
E-mail address: [email protected]