bondimmun.m
来自「Matlab codes for financial models」· M 代码 · 共 20 行
M
20 行
% SET BOND FEATURES
settle = '28-Aug-2000';
maturities = ['15-Jun-2005' ; '31-Oct-2010' ; '01-Mar-2020'];
couponRates = [0.07 ; 0.06 ; 0.08];
yields = [0.06 ; 0.07 ; 0.075];
% COMPUTE DURATIONS AND CONVEXITIES
durations = bnddury(yields, couponRates, settle, maturities);
convexities = bndconvy(yields, couponRates, settle, maturities);
% COMPUTE PORTFOLIO WEIGHTS
A = [durations'
convexities'
1 1 1];
b = [ 10
160
1];
weights = A\b
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?