6
$\begingroup$

somehow I am struggling on my old question concerning set-up an Overnight index in QuantLib (see question: Old Question). What I don't understand is how can I set-up the curve_handle:

index = OvernightIndex("EONIA", 0, EURCurrency(),
                       TARGET(), Actual360(), curve_handle)

I have a set of data for the Singapore Overnight Index Sonar. I don't know how to set-up now the curve_handle in my example below marked as xxxxx. I think I can leave it out as shown below. The code looks like the following:

import QuantLib as ql

todaysDate = ql.Date(10, ql.December, 2017)
ql.Settings.instance().evaluationDate = todaysDate

calendar = ql.Singapore()
dayCounter_Act365 = ql.Actual365()
settlement_days_sonar = 2

SGD_SONAT_OIS = ql.OvernightIndex("SONAR", settlement_days_sonar, ql.SGDCurrency(), calendar, dayCounter_Act365)

#--------------------------------------------------------------------
# Discounting curve
#--------------------------------------------------------------------

# setup DepositRateHelper for 0-1 days
helpers_disc = [ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(rate/100)),
                                     ql.Period(1,ql.Days), fixingDays,
                                     calendar, ql.ModifiedFollowing, False, ql.Actual365())
            for rate, fixingDays in [(0.081, 0)]]

# Overnight Index Swap rate
# setup OISRateHelper for 1,2,3 weeks and 1 month
helpers_disc += [ql.OISRateHelper(settlement_days_sonar, ql.Period(*tenor),
                                  ql.QuoteHandle(ql.SimpleQuote(rate/100)), SGD_SONAT_OIS)
            for rate, tenor in [(0.0713, (1,ql.Weeks)), 
                                (0.0688, (2,ql.Weeks)),
                                (0.0663, (3,ql.Weeks))]]

# OIS quotes up to 30 years
# setup OISRateHelper from 1 months to 30 years
helpers_disc += [ql.OISRateHelper(settlement_days_sonar, ql.Period(*tenor),
                                 ql.QuoteHandle(ql.SimpleQuote(rate/100)), SGD_SONAT_OIS)
            for rate, tenor in [(0.0656, (1,ql.Months)), 
                                (0.0613  , (2,ql.Months)),
                                (0.06 , (3,ql.Months)),
                                (0.0563 , (4,ql.Months)),
                                (0.055  , (5,ql.Months)),
                                (0.0538 , (6,ql.Months)),
                                (0.3356 , (9,ql.Years)),
                                (0.3806 , (10,ql.Years)),
                                (0.4938 , (12,ql.Years)),
                                (0.6888 , (15,ql.Years)),
                                (0.965 , (20,ql.Years)),
                                (1.1081 , (25,ql.Years)),
                                (1.1831, (30,ql.Years))]]

sonar_curve = ql.PiecewiseLogCubicDiscount(date, helpers_disc, ql.Actual365())
sonar_curve.enableExtrapolation()
$\endgroup$
3
$\begingroup$

You can leave it out during the bootstrap of the curve. In that context, the index is only used to ask for its conventions.

Later, if you want to forecast index fixings, you can initialize a handle with the curve you bootstrapped and pass it to the index.

$\endgroup$
  • $\begingroup$ thanks a lot. Do you have an example? $\endgroup$ – JonDoe Jan 4 '18 at 16:15
  • $\begingroup$ curve_handle = YieldTermStructureHandle(bootstrapped_curve); index = OvernightIndex(..., curve_handle) $\endgroup$ – Luigi Ballabio Jan 4 '18 at 19:27
  • $\begingroup$ Hi Luigi, thanks a lot. Somehow it is still not clear for me. Can you be please more explicit with the example above? $\endgroup$ – JonDoe Jan 5 '18 at 9:31
  • $\begingroup$ You're creating a piecewise curve with the helpers, right? That is your bootstrapped_curve. You can put it into a YieldTermStructureHandle and call that curve_handle (first instruction above). Once you have that, create a new OvernightIndex instance with the same arguments as before, plus curve_handle as the last argument (second instruction). You now have an OvernightIndex instance that can forecast fixings using the bootstrapped curve. $\endgroup$ – Luigi Ballabio Jan 5 '18 at 13:39
  • $\begingroup$ Thanks a lot. It can also show the fixingcalendars etc... $\endgroup$ – JonDoe Jan 11 '18 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.