简体   繁体   中英

DiscountCurve is not aware of evaluation date in QuantLib python

I am using quantlib in python. In order to construct a DiscountCurve object, I need to pass a vector of Dates and corresponding discount factors. The problem is that, when I change the evaluation date to account for settlement days, the curve object is not shifted/adjusted properly and the NPV of the bond does not change as a function of evaluation date.

Is there any way around this? Do I have to construct a different DiscountCurve by shifting the dates whenever I change the number of settlement days?

Ideally, instead of passing a vector of dates, I should be able to pass a vector of distances between consecutive dates but the very first date should be allowed to be the evaluation date.

No, unfortunately there's no way around this. For this particular class, you'll have to recreate an instance when your settlement date changes.

Writing a version of the class that takes distances between dates can be done, but it's not currently available. If you write it, please consider creating a pull request for inclusion in the library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM