简体   繁体   English

DiscountCurve不知道QuantLib python中的评估日期

[英]DiscountCurve is not aware of evaluation date in QuantLib python

I am using quantlib in python. 我在python中使用Quantlib。 In order to construct a DiscountCurve object, I need to pass a vector of Dates and corresponding discount factors. 为了构造DiscountCurve对象,我需要传递一个Dates向量和相应的折扣因子。 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. 问题是,当我更改评估日期以计入结算日时,曲线对象未正确移动/调整,并且债券的NPV不会随评估日期而变化。

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? 每当我更改结算天数时,是否必须通过移动日期来构造不同的DiscountCurve?

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. 如果编写它,请考虑创建一个请求请求以包含在库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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