0
$\begingroup$

I think this might be a very trivial question, but since I am pretty unfamiliar with C, this is a bit of a problem for me.

I have created IborIndex somewhere (it is correctly working):

mspr = ql.IborIndex('Mosprime', ql.Period('3M'), 2, ql.RUBCurrency(), ql.Russia(), ql.Following,  True, ql.ActualActual()

Later I want to use it for cap pricing. I create some working yield curve handle:

curve_handle = ql.YieldTermStructureHandle(mosprime3M.curve)

How do I pass it to the IborIndex? My solution is to recreate ql.IborIndex from scratch, using extracted parameters ( like mspr.familyName() ), but I believe there does exist a one-liner. Usual Python notation doesn't seem to work. Could you please help?

$\endgroup$
4
$\begingroup$

Pass a ql.RelinkableYieldTermStructureHandle to the index constructor and then link a curve to it...

curve_handle = ql.RelinkableYieldTermStructureHandle()
mspr = ql.IborIndex(
    'Mosprime', ql.Period('3M'), 2, ql.RUBCurrency(), ql.Russia(),
    ql.Following,  True, ql.ActualActual(),
    curve_handle)

crv = ql.FlatForward(2, ql.Russia(), 0.01, ql.ActualActual())
curve_handle.linkTo(crv)

or clone the index and pass a YieldTermStructureHandle

new_index = mspr.clone(curve_handle)
$\endgroup$
1
  • $\begingroup$ David, you are the best. Thanks a lot. Works exactly as I wanted. $\endgroup$
    – egor_zhev
    Aug 10 '21 at 14:23

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.