gpt4 book ai didi

python - PiecewiseCubicZero 和 PiecewiseLogCubicDiscount 之间的区别

转载 作者:行者123 更新时间:2023-12-01 07:47:32 24 4
gpt4 key购买 nike

我正在创建 PiecewiseCubicZerocurve 和 PiecewiseLogCubicDiscount 并从两条曲线中获取 1 年期零利率。我预计 1 年期零利率将等于 1 年期票面利率。

我有两个问题:

  • 为什么 PiecewiseCubicZerocurve 和 PiecewiseCubicZerocurve 的零利率不同分段对数三次折扣?
  • 为什么 1 年期零利率不等于 1 年期票面利率?

我尝试调整工作日数和惯例。但到目前为止这还没有解决问题。

from QuantLib import *
today = Date(29, 1, 2019)
Settings.instance().evaluationDate = today

convention = Actual365Fixed()

helpers = [OISRateHelper(2, Period(*tenor),
QuoteHandle(SimpleQuote(rate)), Eonia())
for rate, tenor in [(0.001, (1, Years)), (0.002, (2,Years))]]

curve1 = PiecewiseCubicZero(0, TARGET(), helpers, convention)
curve2 = PiecewiseLogCubicDiscount(0, TARGET(), helpers, convention)

print('discount factor (zero)', curve1.discount(today + Period(1, Years)))
print('discount factor (discount)', curve2.discount(today + Period(1, Years)))
print('expected discount factor', 1/(1+0.001))
print('zero (zero)', curve1.zeroRate(today + Period(1, Years), convention, Annual))
print('zero (discount)', curve2.zeroRate(today + Period(1, Years), convention, Annual))
print('expected zero 0.1%')

打印语句输出:

discount factor (zero) 0.9989871380405977
discount factor (discount) 0.9989954702856564
expected discount factor 0.9990009990009991
zero (zero) 0.101389 % Actual/365 (Fixed) Annual compounding
zero (discount) 0.100554 % Actual/365 (Fixed) Annual compounding
expected zero 0.1%

最佳答案

我认为这是营业日 session 和结算日的问题。

当使用 EONIA 标准的 convention = Actual360() 以及 OISRateHelper 中的 0 结算日(而不是 2),我得到以下输出:

zero (zero) 0.099999 % Actual/360 Annual compounding
zero (discount) 0.099999 % Actual/360 Annual compounding
expected zero 0.1%

当使用结算天数 > 0 时,您必须相应地调整曲线和到期日。

关于python - PiecewiseCubicZero 和 PiecewiseLogCubicDiscount 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56389928/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com