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.