Python
為什麼 Euribor 指數的期限不改變 Quantlib 中的即期匯率?
我正在嘗試根據掉期利率在 QuantLib 中創建收益率曲線。我使用的掉期利率有 6 個月的固定頻率和基於 LIBOR 的 3 個月的浮動頻率。
我不明白為什麼改變 Euribor 指數似乎對從收益率曲線得出的即期匯率值沒有影響。請參閱下面的工作範例。
import xlwings as xw import pandas as pd import QuantLib as ql from QuantLib import * from IPython.display import display, HTML import re from pprint import pprint calc_date = Date(22, May, 2019) ql.Settings.instance().evaluationDate = calc_date rates = [0.02437,0.0252475,0.025574,0.02457,0.022801,0.02202,0.021819,0.02188,0.022125,0.022375,0.022682,0.023005,0.023324,0.024505,0.025045,0.025275] tenors = ['1M','3M','6M','1Y','2Y','3Y','4Y','5Y','6Y','7Y','8Y','9Y','10Y','15Y','20Y','30Y',] tenors = [ (int(re.search(r'\d+', tenor).group()), Months if tenor[-1]=='M' else Years) for tenor in tenors ] helpers1 = [ SwapRateHelper(QuoteHandle(SimpleQuote(rate)), Period(*tenor), UnitedStates(), Semiannual, Unadjusted, Thirty360(), Euribor3M()) for tenor, rate in zip(tenors, rates) ] curve1 = PiecewiseFlatForward(0, UnitedStates(), helpers1, Actual360()) print('\nSpot rates from curve 1 based on 3M Euribor.') print(curve1.zeroRate(1, Compounded)) print(curve1.zeroRate(Date(22, May, 2020), Actual360(), Compounded)) print(curve1.zeroRate(Date(22, May, 2020), Actual365Fixed(), Compounded)) helpers2 = [ SwapRateHelper(QuoteHandle(SimpleQuote(rate)), Period(*tenor), UnitedStates(), Semiannual, Unadjusted, Thirty360(), Euribor11M()) for tenor, rate in zip(tenors, rates) ] curve2 = PiecewiseFlatForward(0, UnitedStates(), helpers2, Actual360()) print('\nSpot rates from curve 2 based on 11M Euribor.') print(curve1.zeroRate(1, Compounded)) print(curve1.zeroRate(Date(22, May, 2020), Actual360(), Compounded)) print(curve1.zeroRate(Date(22, May, 2020), Actual365Fixed(), Compounded))
在單曲線框架中,您可以將普通掉期視為浮動利率債券的空頭頭寸和固定利率債券的多頭頭寸(名義值抵消,您有固定利息與浮動利息支付)。
因為您對遠期估計和貼現使用相同的曲線,所以浮動邊的頻率是無關緊要的,因為浮動利率債券將始終保持面值。
在這兩種情況下,使用相同的利率和相同的固定腿頻率,您基本上建構了相同的曲線,因此您得到相同的結果。
它們是不同的,因為您在曲線 2 下再次列印曲線 1。