I have been using Quantlib Addin, now I am looking for the equivalent function for QuantLib in Python:




Or any workaround?


1 Answer 1


I'll try to pen a general answer, since asking a question for each function you'll need won't be very time effective.

The convention for QuantLibXL function names is to map the underlying C++ methods as:

ql{class name}{method name}(object, [parameters])

so, for instance, the method yearFraction(Date d1, Date d2) defined in the class DayCounter, which in C++ is called as

t = object.yearFraction(d1,d2);

in QuantLibXL becomes qlDayCounterYearFraction(object, d1, d2). (Sometimes the class name is shortened; for instance, the method discount in class YieldTermStructure is mapped as qlYieldTSDiscount).

You can invert the principle to find the C++ (or Python) method from the QuantLibXL function. The function qlRateHelperEarliestDate maps the method earliestDate of class RateHelper, so qlRateHelperEarliestDate(rate_helper) corresponds to rate_helper.earliestDate().

The same goes for latestDate, and for most other functions; the first parameter in Excel is the object on which to call the method, and the others are the parameters to pass.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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