辅导案例-QF5203

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
QF5203 Lecture 5
Interest Rate Swaps and their Risk Measures
Part 2
1. References
2. A More Realistic Yield Curve Example
3. Single Currency Tenor Basis Swap
4. Cross Currency Swap
5. Simple Variations of Plain Vanilla Swaps
6. Common Exotic Swaps
7. The Evolution of Yield Curve Construction
8. Summary
9. Homework
10. Project
1. References
• Options, Futures and Other Derivatives, John Hull
• Interest Rate Option Models, Riccardo Rebonato
• Pricing and Trading Interest Rate Derivatives, H. Darbyshire
• QuantLib Python Cookbook, Gautham Balaraman, Luigi Ballabio
• https://www.quantlib.org/quantlibxl/
• For market conventions see https://opengamma.com/wp-
content/uploads/2017/11/Interest-Rate-Instruments-and-Market-
Conventions.pdf
2. A More Realistic Yield Curve Example
• In the previous lecture we looked at the case of using a flat yield curve in
QuantLib Python/Excel in order to focus on the vanilla IRS cash flows
• Obviously, a flat yield curve is not realistic
• We will now show how to build a more realistic yield curve using Deposits, Short
Term Interest Rate Futures (STIRF’s) and Interest Rate Swaps
• We will also look at the functionality that QuantLib provides to study the risk
sensitivities of a portfolio of interest rate swaps
2. A More Realistic Yield Curve Example
USD 3M Libor Swap Curve
Tenor Rate Used Shift (Bp)
ON 1.8200 0.0
TN 1.7500 0.0
S/N 1.8000 0.0
1W 1.7500 0.0
2W 1.7000 0.0
3W 1.6600 0.0
1M 1.6100 0.0
2M 1.4100 0.0
3M 1.2200 0.0
F1 99.4800 0.0
F2 99.6200 0.0
F3 99.6300 0.0
F4 99.6900 0.0
F5 99.7000 0.0
F6 99.6900 0.0
F7 99.6700 0.0
F8 99.6400 0.0
3Y 0.4600 0.0
4Y 0.5100 0.0
5Y 0.5600 0.0
7Y 0.6800 0.0
10Y 0.8100 0.0
12Y 0.8600 0.0
15Y 0.9200 0.0
20Y 0.9700 0.0
25Y 1.0000 0.0
30Y 1.0100 0.0
2. A More Realistic Yield Curve Example
General Inputs Fixed Leg Details Float Leg Details Name Obj ID Error
Quote Date 3-Apr-20 Ccy USD Ccy USD Fixed Leg Schedule IDUSDFixedLegSchedule#0002
Result Ccy USD Notional 100,000,000 Notional 100,000,000 Fixed Leg ID USDFixedLeg#0002
Spot Date 7-Apr-20 Start Date 7-Apr-20 Start Date 7-Apr-20 Fixed Leg NPV 7,802,552
Start Date 7-Apr-20 Maturity 10y Maturity 10y
Maturity 10y End Date 8-Apr-30 End Date 8-Apr-30 Float Leg ScheduleUSDFloatLegSchedule#0002
End Date 8-Apr-30 Pay/Rec REC Pay/Rec PAY Float Leg Index ID USDLiborIndex#0000
Notional 100,000,000 Fwd Swap 0.80800% Margin 0.00% Float Leg ID USDLiborLeg#0000
Coupon 0.80800% Freq Quarterly Fixed Leg NPV 7,802,552
Yc ID USD Yield Curve#0000 Coupon Freq Semiannual Basis Actual/360
Basis 30/360 (Bond Basis) Bus Day ConvModified Following Vanilla Swap ID USDVanillaSwap#0000
Bus Day ConvModified Following Pmt CalendarUnitedStates::Settlement
Pmt CalendarUnitedStates::Settlement Reset CalendarU itedKingdom::Settlement Swap Engine ID USDVanillaSwapDiscountingSwapEngine#0000
Pricing Engine ID TRUE
NPV 0
Npv Details
Fixed Leg 7,802,552 USD 7,802,552 7.80% 7,802,552
Float Leg -7,801,081 USD -7,801,081 -7.80% -7,802,552
Npv Deal 1,471 0.00% 0
3. Single Currency Tenor Basis Swap
• In a tenor basis swap, there is no fixed leg, and one party pays/receives a
(floating) LIBOR of one tenor (e.g. 3m) and the other party receives/pays a
(floating) LIBOR of a different tenor (e.g. 6m)
• Note that in a tenor basis swap the notional on which the rate is applied is in the
same currency
• Other important examples of tenor basis swaps include Overnight Index Swaps
(OIS) where the underlying index is a one-day rate, versus LIBOR (e.g. 3m)
• Theoretically there should be no basis between LIBOR rates of different tenors
(see tenor basis swap spreadsheet included in course material)
• In practice there is a basis and market practice is to add it to the leg with the
shorter tenor
3. Single Currency Tenor Basis Swap
General Inputs Leg 1 Float Details Leg 2 Float Details
Quote Date 3-Apr-20 Notional 100,000,000 Notional 100,000,000
Ccy USD Start Date 7-Apr-20 Start Date 7-Apr-20
Set Evaluation DateTRUE Maturity 5y Maturity 5y
Days to Spot 2 End Date 7-Apr-25 End Date 7-Apr-25
Spot Date 7-Apr-20 Pay/Rec REC Pay/Rec PAY
Float Margin 0.0000% Float Margin 0.0000%
Yield Curve Inputs Frequency Quarterly Frequency Semiannual
Handle USDBasisSwapFlatFwdYieldCurveAccrual Basis Actual/360 Accrual Basis Actual/360
Ndays 0 Float Index LIBOR3M Float Index LIBOR6M
Calendar UnitedStates::SettlementBus Day Conv Modified Following Bus Day Conv Modified Following
Rate 4.00% Pmt CalendarUnitedStates::Settlement Pmt CalendarUnitedStates::Settlement
Day Count Actual/365 (Fixed) Reset CalendarUnitedKingdom::Settlement Reset CalendarUnitedKingdom::Settlement
Compounding Continuous
Frequency Annual
Yc ID USDBasisSwapFlatFwdYieldCurve#0005
Npv Details
Leg 1 18,127,948
Leg 2 -18,127,948
Net -0
4. Cross Currency Swap
• In a cross currency basis swap one party pays (or receives) a foreign floating
LIBOR rate (e.g. USD LIBOR 3m) on an notional denominated in the foreign
currency, and receives (or pays) a domestic floating LIBOR rate (e.g. JPY LIBOR
3m) on a notional denominated in the domestic currency
• On the start date of the swap there is an initial exchange of notional where the
payer (or receiver) of the foreign floating leg receives (or pays) the foreign
notional from (or to) the counterparty and pays (or receives) the domestic
notional to (or from) the counterparty
• On the maturity date of the swap there is a final exchange of notional where the
payer (or receiver) of the USD floating leg pays (or receives) the foreign notional
to (or from) the counterparty and receives (or pays) the domestic notional from
(or to) the counterparty
4. Cross Currency Swap
General Inputs Ccy1 Fixed/Float Details Ccy2 Fixed/Float Details Fixed/Floating Leg 1
Quote Date 3-Apr-20 Ccy USD Ccy JPY
Set Evaluation DateTRUE Notional 100,000,000 Notional 11,000,000,000
Result Ccy USD Notional Exchange BOTH Notional Exchange BOTH
Days to Spot 2 Start Date 7-Apr-20 Start Date 7-Apr-20
Spot Date 7-Apr-20 Maturity 10Y Maturity 10Y
End Date 8-Apr-30 End Date 8-Apr-30
Fx Details Pay/Rec REC Pay/Rec PAY
USD/JPY 110.00 Fixed/Floating FLOAT Fixed/Floating FLOAT
Fixed Rate 0.0000% Fixed Rate 0.0000%
Float Margin 0.00000% Float Margin 0.0000%
Frequency Quarterly Frequency Quarterly
Accrual Basis Actual/360 Accrual Basis Actual/360
Yield Curve 1 Inputs Fixing Method ADVANCE Fixing Method ADVANCE
Handle USDCrossCcySwapFlatFwdYieldCurveloat Index LIBOR3M Float Index LIBOR3M
Ndays 0 Bus Day Conv Modified Following Bus Day Conv Modified Following
Calendar UnitedStates::SettlementPmt CalendarUnitedStates::Settlement Pmt CalendarUnitedStates::Settlement
Rate 4.00% Reset CalendarUnitedKingdom::Settlement Reset CalendarUnitedKingdom::Settlement
Day Count Actual/365 (Fixed) Days To Spot 2 Days To Spot 2
Compounding Continuous
Frequency Annual Ccy1 Bullet Payment Details Ccy2 Bullet Payment Details
Yc ID USDCrossCcySwapFlatFwdYieldCurve#0006Date Amount Date Amount
7-Apr-20 -100,000,000 7-Apr-20 11,000,000,000
Yield Curve 2 Inputs 8-Apr-30 100,000,000 8-Apr-30 -11,000,000,000
Handle JPYCrossCcySwapFlatFwdYieldCurve
Ndays 0
Calendar Japan
Rate 1.00% Npv Details
Day Count Actual/365 (Fixed) USD JPY Npv (USD)
Compounding Continuous Upfront Pmts -99,956,174 10,998,794,587 32,868
Frequency Annual Backend Pmts 66,980,603 -9,951,302,946 -23,485,788
Yc ID JPYCrossCcySwapFlatFwdYieldCurve#0005Fixed/Floating Leg 32,975,571 -1,047,491,640 23,452,920
Fees 0 0 0
Net 0 0 0
5. Simple Variations of Plain Vanilla Swaps
• Forward Starting Swaps
➢ A forward starting fixed versus floating interest rate swap is identical to a
plain vanilla fixed versus floating interest rate swap except for the fact that
it does not start from the spot date (e.g. a 5y 5y forward fixed versus
floating interest rate swap starts in 5y from today and ends in 10y from
today)
➢ The equilibrium swap rate is obtained in the usual way, namely the fixed
rate for which the PV of the fixed leg equals the PV of the floating leg
➢ Note that this is a non-standard swap and would need to be quoted on a
bespoke basis by a bank’s trading desk (banks or brokers do not provide
screens with these rates)
➢ Forward starting swaps are very sensitive to the forward LIBOR rates, and so
interpolation choices are very important
5. Simple Variations of Plain Vanilla Swaps
• Amortising Swaps
➢ Variation of a plain vanilla fixed versus floating swap where the notional on
the fixed and/or floating legs amortises according to a pre-specified
schedule
• Accreting Swaps
➢ Variation of a plain vanilla fixed versus floating swap where the notional on
the fixed and/or floating legs accretes according to a pre-specified schedule
• Step Up Coupon Swaps
➢ Variation of a plain vanilla fixed versus floating swap where the fixed rate
steps up or down
Note that in each case the equilibrium swap rate is obtained in the usual way,
namely the fixed rate for which the PV of the fixed leg equals the PV of the floating
leg
6. Common Exotic Swaps
• LIBOR-in- Arrears Swap
➢ With a plain vanilla swap the LIBOR rate fixes at the beginning of the accrual period and
pays at the beginning of the period
➢ With a LIBOR in arrears swap the LIBOR rate fixes at the end of the period and pays at the
end of the period
➢ A convexity adjustment is required because the forward LIBOR rate is no longer a
Martingale under the measure induced by the zero coupon bond associated with the start
of the accrual period
• Constant Maturity Swap
➢ A constant maturity swap (CMS) is a fixed versus floating swap where the floating index is a
forward swap rate
➢ As with the LIBOR-in-arrears swap a convexity adjustment is required for accurate pricing
• Quanto Swap
➢ A quanto swap is a fixed versus floating swap where the floating index (e.g. LIBOR) is
associated with a different currency than the notional it is applied to
➢ A quanto adjustment to the LIBOR forward rate is required for accurate pricing
7. Yield Curve Construction – Pre GFC
• Before the financial crisis there was little or no difference between Libor rates of
different tenors and similarly the Libor-OIS spread was relatively small and stable
• A single zero coupon curve used for both projecting Libor forwards and
discounting future cash flows
• Implicitly assumed Libor funding
• No tenor basis
• Yield Curve Instruments included:
✓ Cash
✓ FRAs/Futures (eventually included convexity adjustment)
✓ Swaps
• Combined with an interpolation scheme one bootstraps the discount factors
• Leads to a simple expression the PV of the floating leg (see next slide)
7. Yield Curve Construction – Pre GFC
• Recall the interest rate pricing constraints from the previous lecture:
; , +1 =
1
( , +1)
(; )
(; +1)
− 1
=
σ=1
; −1, −1, (; )
σ
=1
−1, (; )
= (; ) − (; )
• In the above is ‘equilibrium’ swap rate, namely the fixed rate for which the
present value of the fixed and floating legs are equal
7. Yield Curve Construction – Pre GFC
• The next level of sophistication came about with the need to include FX related
instruments (i.e. FX Forwards and Cross Currency Basis Swaps) into a consistent
framework
• This was the first attempt by a few (notably USD based banks) to incorporate a
separate forecasting and discounting curves
• Yield Curve Instruments included:
✓ Cash
✓ FRAs/Futures (eventually included convexity adjustment)
✓ Swaps
✓ FX Forwards (up to about 1y) and then Cross Currency Basis Swaps
• Two curves must be bootstrapped together and therefore requires an
optimisation approach rather than simple bootstrapping
• The pricing constraints and screen shot of a cross currency swap are shown on
the next two slides
7. Yield Curve Construction – Pre GFC
• The generalization of the pricing constraints is given by:
; , +1 =
1
(,+1)
(;)
(;+1)
− 1 ; ; , +1 =
1
(,+1)
(;)
(;+1)
− 1
=
σ=1
; −1, −1,
(; )
σ
=1
−1, (; )
; =
σ=1
; −1, −1,
(; )
σ
=1
−1, (; )
=
; −σ=1
;−1, −1,
; −
(;)
σ
=1
−1, (;)
+
; −σ=1
;−1, −1,
; −
(;)
σ
=1
−1, (;)
7. Yield Curve Construction – Post GFC
• In the aftermath of the first credit crisis, single currency tenor basis swaps no
longer traded with a zero basis due to a combination of credit and liquidity
concerns
• Now tenor basis must be explicitly included in our curve construction and
separate Libor projection curves are needed for each index
• Yield Curve Instruments needed to include:
✓ Deposits
✓ FRAs/Futures (eventually included convexity adjustment)
✓ Swaps
✓ FX Forwards (up to about 1y) and then Cross Currency Basis Swaps
✓ Tenor basis swaps (e.g. 3m versus 6m, etc.)
• Earlier in this lecture we went through the cash flows for a USD LIBOR 3m versus
USD LIBOR 6m tenor basis swap
7. Yield Curve Construction – Post GFC
• Another consequence of the GFC is that the LIBOR-OIS basis dramatically widened, and
whereas before the GFC this spread amount to less than 10bp, during the GFC it
widened to more than 300bp
• This called into question the long standing assumption that LIBOR was a good proxy for
the risk free rate required in derivatives valuation
• The overnight index swap (OIS) became the market standard risk free rate to be used for
discounting cash flows
• Overnight Indexes are indexes related to interbank lending over a one day time horizon
• The OIS rate is paid on a compounding basis (see Open Gamma page 43)
• The main OIS indices are:
➢ FED FUNDS
➢ EONIA
➢ SONIA
➢ TONAR
7. Yield Curve Construction – Post GFC
• A further level of complexity was introduced into the swap yield curve construction as a
result of the realization that the collateral arrangements with counterparties directly
impacted the rate to be used for discounting
• There seems to be widespread agreement that the appropriate funding curve to use is
the one associated with the collateral rate specified in the CSA (hence the name CSA
discounting)
• However, due to the variety of CSA agreements, I need to be able to discount any swap
using any one of a number of funding curves (e.g. with EUR swap with an assumed USD
OIS funding
• With one counterparty I might have a EUR swap with a CSA which specifies a USD OIS
collateral rate but with another counterparty I might have a EUR swap with a CSA which
specifies JPY OIS and furthermore I will almost certainly have swaps cleared through
LCH for which EUR OIS is the relevant collateral rate
• The extra funding curves are constructed similarly to the extra index curves where we
now our discount factors are indexed according to the relevant funding curve
7. Yield Curve Construction – Post GFC
• What is a CSA?
• A CSA stands for Credit Support Annex and is essentially an agreement which
specifies the details as to how two parties in an OTC derivative transaction will
exchange collateral
• Important information in a CSA includes:
➢ frequency at which collateral is to be exchanged and any associated haircuts
➢ type of collateral to be exchanged (e.g. cash, government bonds, etc.)
➢ specification of any thresholds (e.g. zero threshold or …)
➢ rehypothecation rights (defines what I can do with the collateral)
➢ bilateral/unilateral
7. Yield Curve Construction – Post GFC
• CSA agreements often grant one or more counterparties the choice of posting
one of several types of collateral (e.g. cash in one 3 currencies, say)
• Such a CSA has embedded in it a chooser type option
• The rational counterparty will choose the collateral for which he obtains the
highest rate of return
• In principle one needs to have a complex term structure model containing
various basis spread volatilities and numerous correlations
• Some (albeit less accurate) alternatives to such a complete framework would be
• Assume a spot cheapest to deliver collateral rate and use this to discount all
future cash flows
• Calculate the intrinsic value of the embedded option on each future cash flow
date and use this as the relevant discounting rate
7. Yield Curve Construction – The Future
• As a result of a few high profile scandals, largely on the back of the global
financial crisis (GFC), the various regulators have decided that IBOR is
• SOFR (Secured Overnight Financing Rate) has been chosen by the U.S. Federal
Reserve’s Alternative Reference Rates Committee (ARRC) as the alternative
reference benchmark to replace U.S. LIBOR
• In Europe, ESTR is the replacement for EONIA, SONIA will continue as the risk
free rate for the United Kingdom, and TONAR will continue as the risk free rate
for Japan
8. Summary
• Before the GFC the use of LIBOR as a discounting curve was market practice
• There was no appreciable basis between LIBOR rates of different tenors
• The use of the same set of discount factors for forward LIBOR rate projection
and the discounting of future cash flows led to a simple formula for the floating
leg of a swap
• The first attempt to separate forecasting from discounting arose as a result of
some (mostly US based) banks using the cross currency basis swap to introduce
a USD LIBOR 3m funding assumption into the valuation of their multi-currency
swap books
• A simple algebraic bootstrapping process was therefore no longer possible and
the determination of the (two) discount curves required the use of a multi-
dimensional solver
8. Summary
• From a derivatives valuation perspective, there were two important
consequences that emerged as a result of the GFC
• First, tenor basis swap no longer traded a flat and so going forward any yield
curve construction algorithm needed to explicitly incorporate this non-zero basis
as a constraint that needed to be satisfied
• Secondly, LIBOR-OIS basis swaps widened dramatically, calling into question the
use of LIBOR as a risk free rate
• Therefore, even for the case of single currency yield curve construction, the
separation of projection and discounting became the market standard and
quickly led to clearing houses like LCH adoption OIS discounting for their
valuations
8. Summary
• The realisation that OIS discounting was required to reflect the requirement to
use a risk free rate, was quickly followed by the realisation that discount curves
need to be ‘CSA aware’
• CSA agreements had previously include the option to post different types of
collateral (e.g. UST’s or Gilts or JGBs) and a modern yield curve infrastructure
needs to incorporate this collateral optionality

9. Homework 5.1
• Using QuantLib Python, implement the USD yield curve with data
provided on slide 5 in a Jupyter notebook.
• Assume the same curve construction date of 3 April 2020
• Demonstrate that your yield curve is able to reproduce the same
inputs that were used to bootstrap the curve.
• Please submit by 13 June 2020
10. Term Project 1 – A Modern Yield Curve
• Using QuantLib Python or QuantLib Excel bootstrap a multi-yield curve which
bootstraps a USD swap yield curve using the instruments shown on slide 30,
namely LIBOR 3m deposits, Interest Rate Futures, OIS swaps, 1m/3m and,
3m/6m tenor basis swaps
• Assume a curve construction date of 3 April 2020
• The instrument definition for USD OIS swaps are
➢ Up to and Including 1y: Annual fixed rate versus OIS compounded and paid at maturity on
an A/360 basis
➢ Beyond 1y: Annual A/360 fixed rate versus OIS compounded annually and paid on an A/360
basis
• Assume that the LIBOR-based instruments shown on slide 30 are OIS discounted
• Confirm that your bootstrapped yield curve is self-consistent by demonstrating
that you can recover the inputs of the instruments used to bootstrap it
• Consider the following portfolio of FRAs, forward starting swaps and tenor basis
swaps
10. Term Project 1 – A Modern Yield Curve
• Consider the following portfolio of FRAs, forward starting swaps and tenor basis
swaps
1. USD 200m of a 9x12 ATM Payer FRA
2. USD 150m of a 6x12 ATM Receiver FRA
3. USD 300m of a 10y 10y ATM forward starting Payer swap
4. USD 100m of a 5y 5y ATM forward starting Receiver swap
5. USD 100m of a 5y Pay LIBOR 3m versus Receive OIS tenor basis swap + Spread
• For the FRAs and Swaps in 1-4 what is the ATM rate?
• For the LIBOR/OIS tenor basis swap, what is the equilibrium (i.e. fair) spread?
• Produce a risk report showing the sensitivity of this portfolio to a 1bp change in
each of the yield curve inputs
• Please submit by 15 June 2020 and be sure to include plenty of comments in
your notebook/Excel Spreadsheet
7. Term Project 1
USD OIS Curve USD 3M Libor USD 1M/3M Libor USD 3M/6M Libor
Tenor Rate Used Tenor Rate Used Tenor Spread (bp) Tenor Spread (bp)
ON 1.6000 ON 1.7500 ON 15.0000 ON 20.0000
TN 1.5900 TN 1.7500 TN 12.0000 TN 15.0000
S/N 1.5900 S/N 1.7500 S/N 10.0000 S/N 12.0000
1W 1.5900 1W 1.7500 1W 9.0000 1W 11.0000
2W 1.5900 2W 1.7500 2W 8.0000 2W 10.0000
3W 1.5900 3W 1.7500 3Y 8.0000 3Y 10.0000
1M 1.5900 1M 1.7500 4Y 8.0000 4Y 10.0000
2M 1.5800 2M 1.7500 5Y 8.0000 5Y 10.0000
3M 1.5700 3M 1.7500 7Y 8.0000 7Y 10.0000
6M 1.5100 F1 98.3500 10Y 8.0000 10Y 10.0000
9M 1.4500 F2 98.4700 12Y 8.0000 12Y 10.0000
1Y 1.3800 F3 98.6000 15Y 8.0000 15Y 10.0000
2Y 1.2200 F4 98.6400 20Y 8.0000 20Y 10.0000
3Y 1.1200 F5 98.7500 25Y 8.0000 25Y 10.0000
4Y 1.1400 F6 98.7900 30Y 8.0000 30Y 10.0000
5Y 1.1500 F7 98.8100
6Y 1.1600 F8 98.7800
7Y 1.1800 3Y 1.3400
8Y 1.2100 4Y 1.3300
9Y 1.2400 5Y 1.3300
10Y 1.2700 6Y 1.3500
12Y 1.3100 7Y 1.3700
15Y 1.3700 8Y 1.4000
20Y 1.4300 9Y 1.4300
25Y 1.4500 10Y 1.4600
30Y 1.4600 12Y 1.5100
15Y 1.5700
20Y 1.6300
25Y 1.6500
30Y 1.6600
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468