对于我的论文,我想通过瑞士政府债券的SvenssonModel计算即期汇率。为此,我采用了fitSvensson函数....实际上我已经从matlab-help-hompage(http://ch.mathworks.com/help/fininst/fitsvenssonirfunctioncurve.html?refresh=true)
中取了示例。但问题是,这个例子只是给了我"债券收益率"但是我想要"现货价格" ...我知道我只需整合整个事情....在主页上(见上面的链接),他们在部分提及"更多关于& #34;如下: - > "这可以被整合以得出零曲线的等式"
这是我的代码:
Settle = datenum('2014,6,13');
Maturity = datemnth(Settle,12*[0.991780822 1.747945205 2.334246575 2.980821918...
3.575342466 4.915068493 6.068493151 6.879452055 7.953424658 8.671232877...
10.00273973 11.12054795 11.96438356 13.04657534 13.83013699 17.03561644...
18.83287671 21.75068493 23.05479452 27.89863014 34.59178082 50.06849315]');
CleanPrice = [103.8388 105.2390 106.2400 112.8682 111.9102 114.1410 113.8762...
111.2851 111.9671 130.4220 104.9018 107.9665 103.3728 130.0583 137.9233...
117.1945 136.5379 120.9674 97.5021 100.7388 167.5365 116.7462]';
CouponRate = [0.0375 0.0250 0.0200 0.0425 0.0300 0.0300 0.0225 0.0200...
0.0200 0.0400 0.0125 0.0150 0.0125 0.0325 0.0400 0.0225 0.0350 0.0250...
0.0125 0.0150 0.0400 0.0200]';
Instruments = [(repmat(Settle,22,1)) Maturity CleanPrice CouponRate];
PlottingPoints = datemnth(Settle,1:360);
% X-Achse Zeitraum
% 1:360 -> 2045; 1:180 -> 2030; 1:90 -> 2022; 1:45 -> 2019
Yield = bndyield(CleanPrice,CouponRate,Settle,Maturity);
SvenssonModel = IRFunctionCurve.fitSvensson('Zero',Settle,Instruments);
SvenssonModel.Parameter
% create the plot
plot(PlottingPoints, getParYields(SvenssonModel, PlottingPoints),'g')
hold on
scatter(Maturity,Yield,'black')
datetick('x')
legend({'Svensson Fitted Curve','Yields'},'location','best')
这就是我所做的整合......但实际上它并没有起作用
%Integral
fun = @(bndyield)('Zero',repmat(Settle,22,1),Instruments);
b = integral(fun,Settle,Maturity,'ArrayValued',false
答案 0 :(得分:0)
债券的现货(=零息票)利率可以通过以下方式轻松检索:
spotrates = SvenssonModel.getZeroRates(Maturity);
如果您需要更深入了解其背后的数学知识,那么包的术语文档(尽管是为R编写的)可以很好地概述Svensson模型的计算步骤。 http://www.jstatsoft.org/v36/i01/paper