0
对于我的论文,我想通过瑞士政府债券的SvenssonModel计算即期汇率。为此,我采取了fitSvensson函数....其实我已经从matlab-help-hompage(http://ch.mathworks.com/help/fininst/fitsvenssonirfunctioncurve.html?refresh=true)Integrate fit.Svensson in Matlab
的例子但问题是,这个例子只是给了我“债券的收益率“但我想要”即期汇率“......我知道我只需要整合整个事情......在主页上(参见上面的链接),他们在”更多关于“部分提到如下: - > “这可以被集成到导出方程零线”
这是我的代码:
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')
,这是我有d一个整合......但实际上这是行不通的
%Integral
fun = @(bndyield)('Zero',repmat(Settle,22,1),Instruments);
b = integral(fun,Settle,Maturity,'ArrayValued',false
不知道什么是即期利率,但该函数确实具有可选参数:FitType(可选)Price,Yield或DurationWeightedPrice确定在曲线拟合过程中哪个最小化。那里面没有东西吗? – GameOfThrows