pythonquantlib-swig

DepositRateHelper unexpected keyword argument 'dayCounter'


I copied the example for EONIA curve bootstrapping. I tried to link the inputs to the corresponding keyword arguments of the DepositRateHelper class. I checked the keyword arguments in the docs, which resulted in the following

import QuantLib as ql
today = ql.Date(11, 12, 2012)
ql.Settings.instance().evaluationDate = today
helpers = [ ql.DepositRateHelper(rate = ql.QuoteHandle(ql.SimpleQuote(rate/100)), 
                             tenor = ql.Period(1,ql.Days), 
                             fixingDays = fixingDays, 
                             calendar = ql.Germany(), 
                             convention = ql.Following, 
                             endOfMonth = False,
                             dayCounter = ql.Actual360()
                             )
        for rate, fixingDays in [(0.04, 0), (0.04, 1), (0.04, 2)] ]

Now I get a TypeError:

TypeError: __init__() got an unexpected keyword argument 'dayCounter'

If skipping all the "keywords" the code works perfectly fine. So my question is, is there a way to get to know the desired keywords or did I search in the wrong place?

Best Daniel


Solution

  • Unfortunately, keywords are allowed in very few classes in the QuantLib module, and DepositRateHelper is not one of them. That's an artifact of the way SWIG exports overloaded constructors; it can't define keywords, since they would have to be different for each overload.

    Also, since SWIG declares wrappers as f(*args, **kwargs) even when it supports keyword arguments, there's no way an IDE can show them. To find them, you'll have to check the SWIG interfaces at https://github.com/lballabio/QuantLib-SWIG/tree/master/SWIG.