版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、安徽财经大学金融证券实验室实验报告实验课程名称金融MATLAB 开课系部金融学院班级学号姓名指导教师2015年*月*日实验名称MATLAB金融数量分析学院学号姓名实验准备实 验 目 的学会使用MATLA金融工具箱进行金融数量分析,如:期权定价分析、投资组 合绩效分析、收益和风险的计算、有效前沿的计算、固定收益证券的久期和 凸度计算、利率的期限结构、技术指标计算等。实 验 设 计 方 案使用MATLAB融工具箱对下述6个主题进行数量分析,数据来源自行在网上搜 寻,要求是2014年之后的数据。(可参照各章的例题)1. 期权定价分析(第10章)2. 收益、风险和有效前沿的计算(第12章)3. 投资组
2、合绩效分析(第13章)4. 固定收益证券的久期和凸度计算(第17章)5. 利率的期限结构(第18章)6. 技术指标分析 (第22章)本头验报告不指疋具体的题目,请大豕自仃设疋,同学相互之1可不要出现雷同。实验分析过程一、收益、风险和有效前沿的计算从Wind咨询金融终端分别下载三只股票(美好集团、石油化服和首开股份)从2013年年初至今的日收盘价价格,经过相关处理得出三只股票的收益率均值、标准差以及协方差矩阵等数据,如下表。现根 据表格数据进行关于收益、风险和有效前沿计算。收益率均值收益率标准差协方差矩阵美好集团0.00180.03120.00100.00040.0005石油化服0.00160.
3、04110.00040.00170.0003首开股份0.00060.03610.00050.00030.00131. 收益率和风险计算函数例1假设等权重配置美好集团、石油化服、首开股份,计算资产组合的风险和收益。 解: ExpReturn=0.0018,0.0016,0.0006;ExpCovariia nce=0.0010,0.0004,0.0005; 0.0004,0.0017,0.0003;0.0005,0.0003,0.0013;PortWts=1/3*o nes(1,3);PortRisk, PortReturn = portstats(ExpReturn, ExpCovaria n
4、ce,PortWts)PortRisk =0.0170PortRetur n =0.00132. 有效前沿计算函数例2.( 1)怎样配置美好集团、石油化服和首开股份,则资产组合为最优组合? 解: ExpReturn=0.0018,0.0016,0.0006; ExpCovariia nce=0.0010,0.0004,0.0005; 0.0004,0.0017,0.0003;0.0005,0.0003,0.0013; NumPorts=10; PortRisk, PortReturn, PortWts = frontcon( ExpReturn,ExpCovaria nee, NumPorts
5、) PortRisk =0.01370.01390.01440.01510.01580.01660.01750.01840.01940.0229PortRetur n =0.00060.00080.00090.00100.00120.00130.00140.00150.00170.0018PortWts =00.04390.956100.17240.82760.02750.26780.70470.10320.30540.59140.17890.34300.47810.25460.38060.36470.33030.41830.25140.40600.45590.13810.48170.4935
6、0.02481.000000画图:frontcon (ExpRetur n,ExpCovaria nee, NumPorts)0.013 0.014 O.OfS 0.016 0.017 0.018 0.019 0 02 0.021 0 022 0.C23 - i I 4,;i:i : .E3罡 prloadx山(2)例2中如果各个资产投资上限为50%,求解有效前沿? ExpReturn=0.0018,0.0016,0.0006;ExpCovariia nce=0.0010,0.0004,0.0005;0.0004,0.0017,0.0003;0.0005,0.0003,0.0013;NumPo
7、rts =10;AssetBo un ds=0,0,0;0.5,0.5,0.5;PortRisk, PortReturn, PortWts = frontcon (ExpReturn,ExpCovaria nee, NumPorts,AssetBou nds) PortRisk =0.01560.01600.01640.01680.01730.01770.01820.01870.01920.0197PortRetur n =0.00110.00120.00130.00130.00140.00140.00150.00160.00160.0017PortWts =0.11960.38040.500
8、00.19670.35190.45140.23440.37060.39490.27220.38940.33850.30990.40810.28200.34760.42680.22560.38530.44560.16910.42300.46430.11260.46080.48310.05620.50000.50000frontcon (ExpRetur n,ExpCovaria nee, NumPorts,AssetBo unds)Risk (Standard Deviation)EEalxpabgdK山3约束条件下有效前沿例3.例配置美好集团、石油化服、首开股份三个资产,美好集团最大配置 60
9、%,石油化服最大配置 70% , 首开股份最大配置 50%,美好集团为资产集合 A,石油化服、首开股份组成资产计划B,集合A的最大配置为70%,集合B的最大配置为50%,集合A的配置不能超过集合 B的3倍,则如何配置?解: NumAssets = 3;ExpReturn=0.0018,0.0016,0.0006;ExpCovariia nce=0.0010,0.0004,0.0005;0.0004,0.0017,0.0003;0.0005,0.0003,0.0013;NumPorts =5;PVal = 1;AssetMin = 0;AssetMax=0.6,0.7,0.5;GroupA =
10、1 0 0; GroupB = 0 1 1;GroupMax =0.7,0.5;AtoBmax = 3;Co nSet = portco ns(PortValue, PV al, NumAssets,AssetLims,.AssetMin, AssetMax, NumAssets, GroupCompariso n,GroupA, NaN,.AtoBmax, GroupB,GroupMax );PortRisk, PortReturn, PortWts = portopt(ExpReturn, ExpCovaria nee, NumPorts, , Co nSet) PortRisk =0.0
11、1560.01650.01760.01870.0199PortRetur n =0.00110.00130.00140.00160.0017PortWts =0.11960.38040.50000.24680.37680.37640.33460.42040.24500.42250.46400.11350.60000.40000画图 portopt(ExpRetur n, ExpCovaria nce,N umPorts, , Con Set)1.8x 103Mean-Variance-Efficient Frontier171.6151.41.31.21.10.0155 0.016 00165
12、 0.017 0.0175 0018 0.0185 0G19 C.01950.02Risk (Standard Deviation)、投资组合绩效分析从Wind咨询金融终端分别下载三只股票(华丽家族、华远地产、合肥城建)和一只指数(中证800 )从2014年年初至今的日收盘价数据,加以处理整理。之后根据 产、合肥城建、中证 800进行投资组合绩效分析。2013-2014年的数据,对华丽家族、华远地日期收攵盘价(兀)2013-01-042643.832013-01-072658.722013-01-082657.142013-01-092659.232013-01-102666.742013-0
13、1-112612.772013-01-142710.22013-01-152736.96中证800华丽家族华远地产合肥城建收盘价(元)收盘价(元)收盘价(元)4.614.016.954.463.946.914.483.947.44.493.97.24.943.987.24.953.796.95.013.97.055.083.917.08解:1. 读取数据 typ, desc, fmt = xlsfinfo(HHHZ.xlsX); data,textdate= xlsread(HHHZ.xlsX); HHHZ=data; save HHHZ HHHZ2. 三只股票和一只指数的精致曲线 load
14、HHHZ figure; hold on plot(HHHZ(:,1)/HHHZ(1,1),k) plot(HHHZ(:,2)/HHHZ(1,2),r-.) plot(HHHZ(:,3)/HHHZ(1,3),bo) plot(HHHZ(:,4)/HHHZ(1,4),g-) xlabel(time) ylabel(price) legend(中证800,华丽家族,华远地产,合肥城建)8 中证日007 .华丽家族O 华远地产 -合聊锻建0 JJJ111LL1Q5D10015020025030D3504D04503. Beta 与 Alpha 计算以中证800作为市场收益,使用portbeta函数分
15、别计算华丽家族、华远地产、合肥城建的beta值。过程如下:(1) betaj 计算load HHHZRate=price1ret(HHHZ);BSbeta=portbeta(Rate(:,4),Rate(:,1);(2)Alpha 计算以中证800作为市场收益,使用portalpha函数分别计算华丽家族、华远地产、合肥城建的beta值。过程如下: load HHHZRate=price2ret(HHHZ);zz800=Rate(:,1);hljz=Rate(:,2);hydc=Rate(:,3);hfcj=Rate(:,4);daynum=fix(le ngth(Rate)/2);cash=(
16、1+0.03F(1/day num)-1;cash=cash* on es(da ynu m,1);RatioHL2013=day num*portalpha(hljz(1:day nu m),zz800(1:day num),cash,c apm)RatioHL2014=day nu m*portalpha(hljz(day nu m+1:2*day num),zz800(day nu m+1:2*day num),cash,capm)RatioHY2013=day nu m*portalpha(hydc(1:day num),zz800(1:day num),cash,capm)Ratio
17、HY2014=day nu m*portalpha(hydc(da yn um+1:2*day nu m),zz800(day nu m+1:2*da yn um),cash,c apm) RatioHF2014=day num*portalpha(hfcj(1:day num),zz800(1:day num),cash,c apm)RatioHF2013=day nu m*portalpha(hfcj(day num+1:2*day num),zz800(day nu m+1:2*da yn um),cash,capm) RatioHL2013 =0.3119RatioHL2014 =0.
18、2903RatioHY2013 =0.1122RatioHY2014 =0.1566RatioHF2013 =0.1046RatioHF2014 =0.03154. 夏普比率计算华丽家族、华远地产、合肥城建的夏普比率 load HHHZRate=price2ret(HHHZ);hljz=Rate(:,2);hydc=Rate(:,3);hfcj=Rate(:,4);daynum=fix(le ngth(Rate)/2);Cash=(1+0.03F(1/day nu m)-1;RatioHL2013=sharpe(hljz(1:day num),Cash)RatioHL2014=sharpe(h
19、ljz(day nu m+1:2*day num),Cash)RatioHYDC2013=sharpe(hydc(1:day num),Cash)RatioHYDC2014=sharpe(hydc(day num+1:2*day num),Cash)RatioHF2013=sharpe(hfcj(1:day num),Cash)RatioHF2014=sharpe(hfcj(day nu m+1:2*da yn um),Cash)结果:RatioHL2013 =0.0768RatioHL2014 =0.0549RatioHYDC2013 =0.0493RatioHYDC2014 =0.0460
20、RatioHF2013 =0.0876RatioHF2014 =0.03775. 信息比率以中证800指数作为业绩比较基准,计算华丽家族、华远地产、合肥城建成长的信息比率 编码: load HHHZRate=price2ret(HHHZ);zz800=Rate(:,1);hljz=Rate(:,2);hydc=Rate(:,3);hfcj=Rate(:,4);daynum=fix(le ngth(Rate)/2);RatioHL2013=i nforatio(hljz(1:day nu m),zz800(1:day num)RatioHL2014=i nforatio(hljz(day nu
21、m+1:2*day nu m),zz800(day num+1:2*day num)RatioHYDC2013=i nforatio(hydc(1:day num),zz800(1:day num)RatioHYDC2014=i nforatio(hydc(day num+1:2*day num),zz800(day num+1:2*day nu m)RatioHF2013=i nforatio(hfcj(1:day num),zz800(1:day nu m)RatioHF2014=i nforatio(hfcj(day nu m+1:2*da yn um),zz800(day num+1:
22、2*day nu m)107.市场指数变化的最大回撤图 根据中证800指数数据画出最大收益回撤 load HHHZ ZZ800price=HHHZ(:,1); N=le ngth(ZZ800price); RetraceRatio=zeros(N,1);for i=2:NC=max(ZZ800price(1:i);if C=ZZ800price(i)RetraceRatio(i)=0;else RetraceRatio(i)=(ZZ800price(i)-C)/C;endendTRate=ZZ800price/ZZ800price(1)-1; f=figure;fill(1:N,N,Retra
23、ceRatio;0,r)hold on plot(TRate); xlabel(time) ylabel(Rate/RetraceRatio)-145040no30on250III-1150eIm12三、固定收益证券的久期和凸度计算从wind资讯金融终端下载三只国债的相关信息如下,进行国定收益证券的久期和凸度的计算。证券编号固定收益证券到期收益率票面利率结算日到期日计息方式15000715附息国债073.04503.540016-Apr-1516-Apr-22每年付息一次15002615附息国债263.06003.050022-Oct-1522-Oct-22每年付息一次15001915附息国债
24、192.90503.14008-Sep158-Sep-20每年付息一次1. 三种债券的价格及计算日的利息计算(1) 15附息国债07的价格和结算日利息计算 Yield=0.03045;Coup on Rate=0.0354;Settle=16-Apr-2015:Maturity=16-Apr-2022:Period=1;Basis=0;Price,Accruedl nt=b ndprice(Yield,Coupo nRate,Settle,Maturity,Period,Basis)Price =102.9320AccruedI nt =0(2) 15附息国债26的价格和结算日利息计算 Yie
25、ld=0.036;Coup on Rate=0.0305;Settle=22-Oct-2015:Maturity=22-Oct-22;Period=1;Basis=0;Price,AccruedI nt=b ndprice(Yield,Coupo nRate,Settle,Maturity,Period,Basis)Price =96.4564AccruedI nt =0(2)15附息国债19的价格和结算日利息计算 Yield=0.02905;Coup on Rate=0.0314;Settle=8-Sep-2015;Maturity=8-Sep-2020;Period=1;Basis=0;P
26、rice,AccruedI nt=b ndprice(Yield,Coupo nRate,Settle,Maturity,Period,Basis)Price =100.9817AccruedI nt =0132. 根据债券价格计算久期(1) 15附息国债07的久期计算PRICE=102.9320;Coup on Rate=0.0354;Settle=16-Apr-2015:Maturity=16-Apr-2022:Period=1;Basis=0;ModDuratio n, YearDurati on, PerDuratio n=b nddurp(Price,Coupo nRate, Set
27、tle, Maturity, Period, Basis)ModDurati on =6.2212YearDurati on =6.3255PerDurati on =12.6509(2) 15附息国债26的久期计算 PRICE=96.4564;Coup on Rate=0.0305;Settle=22-Oct-2015;Maturity=22-Oct-22;Period=1;Basis=0;ModDuratio n, YearDurati on, PerDuratio n=b nddurp(Price,Coupo nRate, Settle, Maturity, Period, Basis)
28、ModDurati on =6.3209YearDurati on =6.4116PerDurati on =12.8233(3) 15附息国债19的久期计算 Price=100.9817;Coup on Rate=0.0314;Settle=8-Sep-2015;Maturity=8-Sep-2020;Period=1;Basis=0;ModDuratio n, YearDurati on, PerDuratio n=b nddurp(Price,Coupo nRate, Settle, Maturity, Period, Basis)14ModDurati on =4.6390YearDu
29、rati on =4.7064PerDurati on =9.41273. 根据债券收益率计算久期(1) 15附息国债07的久期计算 Yield=0.03045;Coup on Rate=0.0354;Settle=16-Apr-2015:Maturity=16-Apr-2022:Period=1;Basis=0;ModDuratio n, YearDuratio n, PerDuratio n=b nddurp(Yield,Coup on Rate, Settle, Maturity, Period, Basis)ModDurati on =0.0931YearDurati on =1.00
30、86PerDurati on =2.0172(2) 15附息国债26的久期计算 Yield=0.036;Coup on Rate=0.0305;Settle=22-Oct-2015:Maturity=22-Oct-22:Period=1;Basis=0;ModDuratio n, YearDuratio n, PerDuratio n=b nddurp(Yield,Coup on Rate, Settle, Maturity, Period, Basis)ModDurati on =0.1093YearDurati on =1.0118PerDurati on =2.023615(3) 15附
31、息国债19的久期计算 Yield=0.02905;Coup on Rate=0.0314;Settle=8-Sep-2015:Maturity=8-Sep-2020:Period=1;Basis=0;ModDuratio n, YearDuratio n, PerDuratio n=b nddurp(Yield,Coup on Rate, Settle, Maturity, Period, Basis)ModDurati on =0.0966YearDurati on =1.0093PerDurati on =2.01853.根据价格计算凸度(1) 15附息国债07的凸度计算 Price=10
32、2.9320;Coup on Rate=0.0354;Settle=16-Apr-2015:Maturity=16-Apr-2022:Period=1;Basis=0;YearC on vexity,PerC on vexity=b ndcon vp(Price,Coup on Rate, Settle, Maturity, Period, Basis)YearC on vexity =44.4010PerC on vexity =177.6039(2) 15附息国债26的凸度计算 Price=96.4564;Coup on Rate=0.0305;Settle=22-Oct-2015;Maturity=22-Oct-22;Period=1;Basis=0;YearC on vexity,PerC on vexity=b ndcon vp(Price,Coup on Rate, Settle, Maturity, Period, Basis) YearC on
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年度民用航空货运代理绿色物流合作协议
- 2024年度人工智能技术研发与产业化合同
- 《三大方言区苗族古歌的“创世叙事”文本比较》
- 四川农商联合银行招聘笔试真题2023
- 爱情忠诚合同范本
- 二零二四年度技术转让合同的性质及服务内容明确
- 二零二四年度南汇农业志农产品溯源体系建设与运营合同
- 二零二四年广告传媒公司宣传推广合同
- 2024版广告牌安装工程合同
- 委托贸易合同范本
- 4.2主动运输与胞吞胞吐教案高一上学期生物人教版必修1
- 2024至2030年中国it外包服务行业市场深度分析及发展趋势预测报告
- 承包商安全生产操作规程
- 《温室气体自愿减排项目方法学造林碳汇(CCER-14-001-V01)》
- LTPS-CVD工艺设备介绍(超详细)
- 模拟法庭剧本赡养纠纷案
- Module 9 Unit 2 I feel happy 单元整体教学设计
- JT-T-325-2018营运客运类型划分及等级评定
- 2024年内蒙古自治区事业单位联考招聘易考易错模拟试题(共500题)试卷后附参考答案
- 行政复议法-形考作业3-国开(ZJ)-参考资料
- 膝关节骨性关节炎的阶梯治疗
评论
0/150
提交评论