Adding FRA Rate Helpers to a Sterling Libor Curve Bootstrap
Summary
The document describes building a six-month sterling Libor yield curve in QuantLib from a deposit quote and swap rates, then asks how to incorporate forward rate agreements. It shows the existing curve-building setup and its resulting spot-rate table, followed by an answer that constructs a FRA rate helper for each supplied start and end month pair using the corresponding quote and the six-month Libor index. The helpers are appended to the rate-helper collection used for bootstrapping.
This is a concise implementation example for adding FRA market instruments to a curve calibration. The displayed answer uses the start month and index in the helper constructor; it does not explain the constructor’s conventions, discuss quote units or date calendars, or show output after the FRAs are included. Those details should be checked against the QuantLib API and the intended market conventions before relying on the resulting curve.
Key ideas
- Deposit, swap, and FRA quotes can be represented as rate helpers in curve bootstrapping.
- The example creates a FRA helper for each supplied forward period and rate.
- The FRA helpers are added to the same helper collection used to build the curve.
- The example does not explain market conventions or show the recalibrated curve output.
Tags
Full text
# Bootstrapping the 6m Sterling Libor curve
# Bootstrapping the 6m Sterling Libor curve
I am trying to bootstrap the 6m sterling swap curve using the depos and swap rates codes are below. I am a newbie and have been following (or at least trying to!) the python cookbook. I wanted to know how do I add FRA to the mix?i.e. how do I create helpers for FRAs
assuming I have these FRAs
```
FRAs = {(1, 7): 0.037125, (2, 8): 0.037125, (3, 9): 0.037125}
```
(and also wanted to check if the below code makes sense)
```
import QuantLib as ql
import pandas as pd
today= ql.Date(1,4,2020)
ql.Settings.instance().evaluationDate = today
quote = ql.QuoteHandle(ql.SimpleQuote(0.72863/100))
tenor = ql.Period('6M')
fixingDays = 2
calendar = ql.TARGET()
convention = ql.ModifiedFollowing
endOfMonth = False
dayCounter = ql.Actual365Fixed()
GBPLibor = ql.GBPLibor(ql.Period('6M'))
depo_helper = [ql.DepositRateHelper(quote,tenor,fixingDays,calendar,convention,endOfMonth,dayCounter)]
swap_helpers = [ql.SwapRateHelper(ql.QuoteHandle(ql.SimpleQuote(rate/100.0)), ql.Period(*tenor), calendar,ql.Semiannual,ql.Following,ql.Actual365Fixed(),GBPLibor)
for tenor, rate in [((1,ql.Years),.5635),
((2,ql.Years),0.4929),
((3,ql.Years),.4764),
((4,ql.Years), .4917),
((5,ql.Years), .5007),
((6,ql.Years), .5136),
((7,ql.Years), .5247),
((8,ql.Years), .5331),
((9,ql.Years), .5424),
((10,ql.Years),.5489),
((12,ql.Years),.5647),
((15,ql.Years),.5843),
((20,ql.Years),.5869),
((25,ql.Years),.5690),
((30,ql.Years),.5380),
((40,ql.Years),.4761),
((50,ql.Years),.4381)]]
rate_helpers = depo_helper + swap_helpers
GBP6mLiborCurve = ql.PiecewiseCubicZero(today,rate_helpers,ql.Actual365Fixed())
spots = []
tenors = []
for d in GBP6mLiborCurve.dates():
yrs = ql.Actual365Fixed().yearFraction(today,d)
compounding = ql.Simple
freq = ql.Semiannual
zero_rate=GBP6mLiborCurve.zeroRate(yrs,compounding,freq)
tenors.append(yrs)
eq_rate=zero_rate.equivalentRate(ql.Actual365Fixed(),compounding,freq,today,d).rate()
spots.append(100*eq_rate)
datatable={'Dates':GBP6mLiborCurve.dates(),'Tenors':tenors,'spots':spots}
df=pd.DataFrame.from_dict((datatable))
print(df)
```
Output
```
Dates Tenors spots
0 April 1st, 2020 0.000000 0.000000
1 October 5th, 2020 0.512329 0.728645
2 April 1st, 2021 1.000000 0.564059
3 April 1st, 2022 2.000000 0.494446
4 April 3rd, 2023 3.005479 0.478995
5 April 2nd, 2024 4.005479 0.495879
6 April 1st, 2025 5.002740 0.506411
7 April 1st, 2026 6.002740 0.521119
8 April 1st, 2027 7.002740 0.534104
9 April 3rd, 2028 8.010959 0.544392
10 April 3rd, 2029 9.010959 0.555760
11 April 1st, 2030 10.005479 0.564234
12 April 1st, 2032 12.008219 0.584600
13 April 2nd, 2035 15.010959 0.611500
14 April 3rd, 2040 20.019178 0.623278
15 April 3rd, 2045 25.021918 0.610436
16 April 1st, 2050 30.019178 0.580321
17 April 1st, 2060 40.027397 0.516318
18 April 1st, 2070 50.032877 0.479267
```
## Answer by David Duarte (score 0)
https://quant.stackexchange.com/a/52988
You can add this to your code:
```
FRAs = {(1, 7): 0.037125, (2, 8): 0.037125, (3, 9): 0.037125}
for fra in FRAs:
rate = FRAs.get(fra)
start = fra[0]
helper = ql.FraRateHelper(rate, start, GBPLibor)
rate_helpers.append(helper)
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.