Skip to content
All library documents

Bootstrapping an Overnight Index Swap Curve from Market Quotes

Article Quant Q&A · Author: sp1r0u

Summary

The document asks how to construct a euro overnight index swap curve in QuantLib from market quotes. It describes obtaining an overnight rate and swap curve members, sorting instrument quotes by maturity, and creating deposit and overnight swap rate helpers. The central question is which yield term structure should be built from those helpers to produce discount factors.

The code uses Bloomberg data for the quotes and sets calendar, settlement, and day-count conventions before building the helpers. This is useful as a sketch of the market-data-to-curve workflow: instrument quotes are translated into rate helpers that a curve-building process can bootstrap. However, the document supplies no completed curve definition, calibration output, or validation against independent discount factors. It also leaves practical details such as quote units, curve conventions, and appropriate curve interpolation unresolved, so the example should not be treated as a verified implementation.

Key ideas

  • Market quotes can be represented as deposit and swap rate helpers for curve construction.
  • The example uses an overnight index and overnight swap instruments to build an overnight curve.
  • Calendar, settlement, and day-count conventions are part of the curve setup.
  • The document asks which yield term structure to use but does not provide the completed construction or results.
  • Quote conventions and curve validation remain necessary implementation considerations.

Tags

Full text
# Quantlib: swap curve discount rate from spot rates


# Quantlib: swap curve discount rate from spot rates












I'm new to Quantlib on Python and I'd like to use the overnight swap rate from Bloomberg to derive the swap curve discount factors. I don't know which yield term structure I should specify?

I checked the QuantLib Python Cookbook and the QuantLib-Python Documentation https://quantlib-python-docs.readthedocs.io/en/latest/index.html.

Below is the code

```
import pandas   as pd
import numpy    as np
import QuantLib as ql

from xbbg     import blp
from datetime import date, timedelta

calendar = ql.TARGET ()

evaluationDate = date.today ()
settlementDay  = 2 

evaluationDate = ql.Date (evaluationDate.day, evaluationDate.month, evaluationDate.year)
ql.Settings.instance ().evaluationDate = evaluationDate

settlementDate = calendar.advance (evaluationDate, ql.Period (settlementDay, ql.Days))

estr  = ql.Estr ()

depositDayCounter       = ql.Actual360 ()
termStructureDayCounter = ql.Actual365Fixed ()

EUR_OVERNIGHT_RATE = 'ESTRON Index'
ON_dfObj = blp.bdp (tickers = EUR_OVERNIGHT_RATE, flds = ['PX_LAST', 'SECURITY_NAME'])

EUR_OIS_ESTR  = 'YCSW0514 Index'
dfObj = blp.bds (tickers = EUR_OIS_ESTR, flds = ['CURVE_MEMBERS'])
ESTR_dfObj = blp.bdp (tickers = dfObj ['curve_members'].tolist (), flds = ['PX_BID', 'SECURITY_NAME', 'MATURITY', 'SECURITY_TENOR_TWO'])
ESTR_dfObj ['maturity'] = pd.to_datetime (ESTR_dfObj ['maturity'])
ESTR_dfObj ['time_to_maturity'] = (ESTR_dfObj ['maturity'] - pd.to_datetime (date.today ())) / np.timedelta64 (1, 'Y')
ESTR_dfObj.sort_values (by = 'time_to_maturity', inplace = True)

helpers = [ql.DepositRateHelper (ON_dfObj ['px_last'].values [0], estr)]

zip_ = zip (ESTR_dfObj ['px_bid'].values, ESTR_dfObj ['security_tenor_two'].values)
tmp  = [ql.OISRateHelper (settlementDay, ql.Period (tenor), ql.QuoteHandle (ql.SimpleQuote (rate)), estr) for rate, tenor in zip_]
helpers += tmp

//Which structure should be used here?
ESTR_curve = ql.????
```

Any help will be most welcomed, thanks.

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.