3
$\begingroup$

I'm currently using QuantLib Python. Let's say that I've got a VanillaSwap object:

import QuantLib as ql
swap_obj = ql.VanillaSwap(... , iborIndex , ...)

How can I find out what is the underlying iborIndex of the swap object?

I've tried the following already, but none of the following works:

swap_obj.index
swap_obj.iborIndex
swap_obj.index()
swap_obj.iborIndex()
$\endgroup$
4
$\begingroup$

It's a bit awkward. Cashflows and indexes are stored as pointers to their base class and you can't cast them directly from Python, so the module provides a few helper functions from that. You can do something like:

first_coupon = as_floating_rate_coupon(swap_obj.floatingLeg()[0])
ibor = as_iborindex(first_coupon.index())

(Using, e.g., just first_coupon.index() would give you an instance of FloatingRateIndex, so it wouldn't have the complete interface of IborIndex.)

$\endgroup$

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.