我正在创建一个PiecewiseCubicZerocurve和一个PiecewiseLogCubicDiscount并从两条曲线中获得1年零利率。我希望我的1年零利率等于1年票面利率。
我有两个问题:
为什么PiecewiseCubicZerocurve和
PiecewiseLogCubicDiscount?
为什么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%
最佳答案
我认为这是工作日公约和结算日的问题。
使用EONIA的标准convention = Actual360()
和0
(而不是OISRateHelper
)中的2
结算天数时,我得到以下输出:
zero (zero) 0.099999 % Actual/360 Annual compounding
zero (discount) 0.099999 % Actual/360 Annual compounding
expected zero 0.1%
当使用结算天数> 0时,必须相应地调整曲线和到期日。