'Why do I get an error when building a zero coupon inflation swap helper in Quantlib?
I am trying to create a ZC Inflation Swap Helper but I get an error for the below code, does anyone know what the issue is?
import QuantLib as ql
quote = ql.QuoteHandle(ql.SimpleQuote(0.02))
period = ql.Period('3M')
date = ql.Date(15,3,2022)
calendar = ql.TARGET()
convention = ql.ModifiedFollowing
daycounter = ql.Actual360()
index = ql.EUHICPXT(True)
helper = ql.ZeroCouponInflationSwapHelper(quote, period, date, calendar, convention, daycounter, index)
{TypeError}Wrong number or type of arguments for overloaded function 'new_ZeroCouponInflationSwapHelper'. Possible C/C++ prototypes are: ZeroCouponInflationSwapHelper::ZeroCouponInflationSwapHelper(Handle< Quote > const &,Period const &,Date const &,Calendar const &,BusinessDayConvention,DayCounter const &,ext::shared_ptr< ZeroInflationIndex > const &,CPI::InterpolationType,Handle< YieldTermStructure > const &) ZeroCouponInflationSwapHelper::ZeroCouponInflationSwapHelper(Handle< Quote > const &,Period const &,Date const &,Calendar const &,BusinessDayConvention,DayCounter const &,ext::shared_ptr< ZeroInflationIndex > const &,Handle< YieldTermStructure > const &)
This is the same code as the QuantLib userguide...
Solution 1:[1]
Posted the issue on Github ... looks like documentation hasn't been updated since the last QuantLib update.
https://github.com/lballabio/QuantLib/issues/1360
The following should work:
import QuantLib as ql
quote = ql.QuoteHandle(ql.SimpleQuote(0.02))
period = ql.Period('6M')
date = ql.Date(15,6,2020)
calendar = ql.TARGET()
convention = ql.ModifiedFollowing
daycounter = ql.Actual360()
index = ql.EUHICPXT(True)
flatForward = ql.FlatForward(ql.Date(15,6,2020), ql.QuoteHandle(ql.SimpleQuote(0.05)), ql.Actual360())
yieldTermStructure = ql.YieldTermStructureHandle(flatForward)
helper = ql.ZeroCouponInflationSwapHelper(quote, period, date, calendar, convention, daycounter, index, yieldTermStructure)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | AB123 |