




已阅读5页,还剩13页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
。MATLAB金融计算试题(2014级研究生用)(上机操作使用)一、利率期限结构(20分) 已知国债面值是100美元,各期收益率为国债品种票息到期日当期收益3个月17-Apr-20131.156个月17-Jul-20131.182年1.7531-Dec-20141.685年3.0015-Nov-20172.9710年4.0015-Nov-20224.0130年5.37515-Feb-20414.92 试分析其利率期限结构。MATLAB命令: bonds=datenum(04/17/2013) 0 100; datenum(07/17/2013) 0 100; datenum(12/31/2014) 0.0175 100; datenum(11/15/2017) 0.03 100; datenum(11/15/2022) 0.04 100; datenum(02/15/2041) 0.0537 100; yield=0.0115 0.0118 0.0168 0.0297 0.0401 0.0492; settle=datenum(01/17/2013); %结算日 zerorates,curvedates=zbtyield(bonds,yield,settle) datestr(curvedates) plot(zerorates)运行结果:zerorates = 0.0115 0.0118 0.0168 0.0302 0.0418 0.0550curvedates = 735341 735432 735964 737014 738840 745507ans =17-Apr-201317-Jul-201331-Dec-201415-Nov-201715-Nov-202215-Feb-2041二、期权定价(30分)若股票现在价格为$50,期权执行价格为$52,无风险利率为0.1,股票波动标准差为0.4,期权的到期日为6个月,且若这一卖权在3.5月时有一次股息支付$2。(1) 使用Black-Scholes定价公式计算欧式卖权和买权的价值;MATLAB命令:price=50;strike=52;rate=0.1;time=6/12;volatility=0.4;callprice,putprice=blsprice(price,strike,rate,time,volatility)运行结果:callprice = 5.8651putprice = 5.3290(2) 利用二项式期权定价(二叉树(CRR)模型定价数值解)计算看涨看跌期权价格;MATLAB命令:price=50;strike=52;rate=0.1;time=6/12;increment=1/12;volatility=0.4;flag=0;dividentrate=0;divident=2;exdiv=3.5;price,option=binprice(price,strike,rate,time,increment,volatility,flag,dividentrate,divident,exdiv)运行结果:得出二叉树每个交点处的资产价格和期权价值.price = 50.0000 55.8985 62.5172 69.9441 76.2699 85.6054 96.0836 0 44.7755 50.0326 55.9315 60.5420 67.9524 76.2699 0 0 40.1226 44.8084 48.0575 53.9398 60.5420 0 0 0 35.9790 38.1474 42.8167 48.0575 0 0 0 0 30.2809 33.9873 38.1474 0 0 0 0 0 26.9787 30.2809 0 0 0 0 0 0 24.0366option = 6.7016 3.9308 1.7652 0.4598 0 0 0 0 9.6686 6.2275 3.1393 0.9412 0 0 0 0 13.3762 9.5132 5.4560 1.9263 0 0 0 0 17.5811 13.8526 9.1833 3.9425 0 0 0 0 21.7191 18.0127 13.8526 0 0 0 0 0 25.0213 21.7191 0 0 0 0 0 0 27.9634由结果可知,option第一行第一列就是看跌期权价格,该期权价格为6.7016元。MATLAB命令:price=50;strike=52;rate=0.1;time=6/12;increment=1/12;volatility=0.4;flag=1;dividentrate=0;divident=2;exdiv=3.5;price,option=binprice(price,strike,rate,time,increment,volatility,flag,dividentrate,divident,exdiv)运行结果:得出二叉树每个交点处的资产价格和期权价值.price = 50.0000 55.8985 62.5172 69.9441 76.2699 85.6054 96.0836 0 44.7755 50.0326 55.9315 60.5420 67.9524 76.2699 0 0 40.1226 44.8084 48.0575 53.9398 60.5420 0 0 0 35.9790 38.1474 42.8167 48.0575 0 0 0 0 30.2809 33.9873 38.1474 0 0 0 0 0 26.9787 30.2809 0 0 0 0 0 0 24.0366option = 4.9996 7.8792 12.0864 17.9441 25.1294 34.0369 44.0836 0 2.1193 3.6809 6.2599 10.3427 16.3840 24.2699 0 0 0.5473 1.0878 2.1622 4.2976 8.5420 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0由结果可知,option第一行第一列就是看涨期权价格,该期权价格为4.9996元。 (3) 假设股票价格服从几何布朗运动,试用蒙特卡洛模拟方法计算该期权价格。MATLAB命令:s0=50;K=52;r=0.1;T=0.5;sigma=0.4;Nu=1000;randn(seed,0); %定义随机数发生器种子是0, %这样保证每次模拟的结果相同nuT=(r-0.5*sigma2)*Tsit=sigma*sqrt(T)discpayoff=exp(-r*T)*max(0,s0*exp(nuT+sit*randn(Nu,1)-K);%期权到期时的现金流eucall,varprice,ci=normfit(discpayoff)运行结果:nuT = 0.0100sit = 0.2828eucall = 6.1478varprice = 10.2924ci = 5.5091 6.7865三、搜集数据并计算画图(50分)按照自己的研究生学号后两位数,在锐思金融数据库中搜集4种股票信息,包括最高价、最低价、收盘价和开盘价,数据个数2个月左右,建立数据表格。要求使用MATLAB编程解决以下问题:(1) 将4种股票的收盘价格转化为收益率,并画出收益率直方图海虹控股MATLAB命令:TickSeries=31.63 32.17 31.58 30.71 30.77 30.93 31.79 31.58 32 33.91 33.12 34.98 35.3 35.5 34.65 35.46 35.95 35.39 37.67 36.64 36.77 36.85 36.59 35.81 35.18 35.76 36.66 38.35 38.26 38.34 38.85 41.27 40.99 40.7 42.28;RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel(天数);ylabel(收益率);title(海虹控股对数收益率直方图);运行结果:RetSeries = 0.0171 -0.0183 -0.0275 0.0020 0.0052 0.0278 -0.0066 0.0133 0.0597 -0.0233 0.0562 0.0091 0.0057 -0.0239 0.0234 0.0138 -0.0156 0.0644 -0.0273 0.0035 0.0022 -0.0071 -0.0213 -0.0176 0.0165 0.0252 0.0461 -0.0023 0.0021 0.0133 0.0623 -0.0068 -0.0071 0.0388盛达矿业MATLAB命令:TickSeries=13.07 12.88 13.19 12.98 12.78 12.49 12.73 12.51 12.97 13.06 12.68 13.17 13.93 14.39 14.08 14.34 14.19 14.24 13.74 13.57 13.8 13.76 13.76 13.52 13.3 13.28 13.44 13.37 13.28 13.74 13.93 14.16 13.99 14.73 14.7;RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel(天数);ylabel(收益率);title(盛达矿业对数收益率直方图);运行结果:RetSeries = -0.0145 0.0241 -0.0159 -0.0154 -0.0227 0.0192 -0.0173 0.0368 0.0069 -0.0291 0.0386 0.0577 0.0330 -0.0215 0.0185 -0.0105 0.0035 -0.0351 -0.0124 0.0169 -0.0029 0 -0.0174 -0.0163 -0.0015 0.0120 -0.0052 -0.0067 0.0346 0.0138 0.0165 -0.0120 0.0529 -0.0020恒逸石化MATLAB命令:TickSeries=9.43 9.14 8.99 8.67 8.6 8.42 8.49 8.4 8.53 8.97 8.61 8.91 9.11 9.12 9.06 9.14 9.04 8.79 8.7 8.78 8.83 9.37 9.47 9.3 9.55 9.89 9.69 9.64 9.58 9.52 9.88 10.22 10.3 10.45 10.84;RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel(天数);ylabel(收益率);title(恒逸石化对数收益率直方图);运行结果:RetSeries = -0.0308 -0.0164 -0.0356 -0.0081 -0.0209 0.0083 -0.0106 0.0155 0.0516 -0.0401 0.0348 0.0224 0.0011 -0.0066 0.0088 -0.0109 -0.0277 -0.0102 0.0092 0.0057 0.0612 0.0107 -0.0180 0.0269 0.0356 -0.0202 -0.0052 -0.0062 -0.0063 0.0378 0.0344 0.0078 0.0146 0.0373金宇车城MATLAB命令:TickSeries=10.9 11.17 11.32 11.32 11.22 11.08 11.27 11.19 11.31 11.52 11.25 11.78 12.07 12.11 12.15 12.29 12.45 12.87 12.77 12.63 12.56 12.71 12.71 12.5 12.15 12.23 12.12 12.48 12.6 12.87 12.9 13.33 13.5 13.5 13.42;RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel(天数);ylabel(收益率);title(金宇车城对数收益率直方图);运行结果:RetSeries = 0.0248 0.0134 0 -0.0088 -0.0125 0.0171 -0.0071 0.0107 0.0186 -0.0234 0.0471 0.0246 0.0033 0.0033 0.0115 0.0130 0.0337 -0.0078 -0.0110 -0.0055 0.0119 0 -0.0165 -0.0280 0.0066 -0.0090 0.0297 0.0096 0.0214 0.0023 0.0333 0.0128 0 -0.0059(2) 计算4种股票收盘价的协方差矩阵;MATLAB命令:A=31.63 13.07 9.43 10.932.17 12.88 9.14 11.1731.58 13.19 8.99 11.3230.71 12.98 8.67 11.3230.77 12.78 8.6 11.2230.93 12.49 8.42 11.0831.79 12.73 8.49 11.2731.58 12.51 8.4 11.1932 12.97 8.53 11.3133.91 13.06 8.97 11.5233.12 12.68 8.61 11.2534.98 13.17 8.91 11.7835.3 13.93 9.11 12.0735.5 14.39 9.12 12.1134.65 14.08 9.06 12.1535.46 14.34 9.14 12.2935.95 14.19 9.04 12.4535.39 14.24 8.79 12.8737.67 13.74 8.7 12.7736.64 13.57 8.78 12.6336.77 13.8 8.83 12.5636.85 13.76 9.37 12.7136.59 13.76 9.47 12.7135.81 13.52 9.3 12.535.18 13.3 9.55 12.1535.76 13.28 9.89 12.2336.66 13.44 9.69 12.1238.35 13.37 9.64 12.4838.26 13.28 9.58 12.638.34 13.74 9.52 12.8738.85 13.93 9.88 12.941.27 14.16 10.22 13.3340.99 13.99 10.3 13.540.7 14.73 10.45 13.542.28 14.7 10.84 13.42cov(A)运行结果:ans = 10.0608 1.4751 1.5687 2.3059 1.4751 0.3711 0.2270 0.3857 1.5687 0.2270 0.3682 0.3326 2.3059 0.3857 0.3326 0.5837(3) 若给出这4种股票预期收益率分别为0.3、0.25、0.2和0.15,且购买权重分别0.35、0. 25、0.25和0.15,求总资产的标准差和期望收益;MATLAB命令:ExpReturn=0.3,0.25,0.2,0.15;ExpCovariance= 10.0608 1.4751 1.5687 2.3059 1.4751 0.3711 0.2270 0.3857 1.5687 0.2270 0.3682 0.3326 2.3059 0.3857 0.3326 0.5837;PortWts=0.35 0.25 0.25 0.15;PortRisk,PortReturn=portstats(ExpReturn, ExpCovariance,PortWts)运行结果:PortRisk = 1.4659PortReturn = 0.2400(4) 求该资产组合有效前沿(有效前沿的个数选为5);MATLAB命令:ExpReturn=0.3 0.25 0.2 0.15;ExpCovariance=10.0608 1.4751 1.5687 2.3059 1.4751 0.3711 0.2270 0.3857 1.5687 0.2270 0.3682 0.3326 2.3059 0.3857 0.3326 0.5837;NumPorts=5;PortRink,PortReturn,PortWts=frontcon(ExpReturn,ExpCovariance,NumPorts)运行结果:PortRink = 0.5462 0.5820 1.1729 2.1585 3.1719PortReturn = 0.2247 0.2436 0.2624 0.2812 0.3000PortWts = -0.0000 0.4949 0.5051 0.0000 0 0.8712 0.1288 -0.0000 0.2475 0.7525 0 -0.0000 0.6237 0.3763 0 -0.0000 1.0000 0 0.0000 -0.0000(5) 无风险利率为0.35,借贷利率为0.5,投资者风险厌恶系数为3,求考虑无风险资产及借贷情况下的最优资产配置。MATLAB命令:ExpReturn=0.3 0.25 0.2 0.15;ExpCovariance=10.0608 1.4751 1.5687 2.3059 1.4751 0.3711 0.2270 0.3857 1.5687 0.2270 0.3682 0.3326 2.3059 0.3857 0.3326 0.5837;RisklessRate=0.035;BorrowRate=0.5;RiskAversion=3;PortRisk,PortReturn,PortWts=portopt(ExpReturn,ExpCovariance)RiskyRink, RiskyReturn, RiskyWts, RiskyFraction,OverallRick, OverallReturn=portalloc(PortRisk,.PortReturn, PortWts, RisklessRate,BorrowRate, RiskAversion)运行结果:PortRisk = 0.5462 0.5534 0.5747 0.6084 0.9663 1.3864 1.8246 2.2704 2.7200 3.1719PortReturn = 0.2247 0.2331 0.2415 0.2498 0.2582 0.2666 0.2749 0.2833 0.2916 0.3000PortWts = -0.0000 0.4949 0.5051 0.0000 0 0.6621 0.3379 -0.0000 0.0000 0.8294 0.1706 -0.0000 0 0.9966 0.0034 -0.0000 0.1638 0.8362 0 -0.0000 0.3311 0.6689 0 0.0000 0.4983 0.5017 0 -0.0000 0.6655 0.3345 0 -0.0000 0.8328 0.1672 0 0.0000 1.0000 0 0.0000 -0.0000RiskyRink = 0.5427RiskyReturn = 0.2302RiskyWts = -0.0000 0.6040 0.3960 -0.0000RiskyFraction = 0.2209OverallRick = 0.1199OverallReturn = 0.0781(6)绘制这4种股票的最高价、最低价、收盘价和开盘价的烛型图。海虹控股MATLAB命令:a=31.9 30.54 31.63 31.2932.35 30.71 32.17 31.332.6 31.56 31.58 32.0832 30.7 30.71 31.8231.59 30.45 30.77 30.5531.2 30 30.93 30.632.2 30.94 31.79 30.9432.18 31.52 31.58 31.7832.11 31.43 32 31.633.91 31.91 33.91 32.135.57 32.5 33.12 32.8335.4 33.26 34.98 33.2635.57 34.28 35.3 34.9636.49 35.1 35.5 35.335.8 34.45 34.65 35.335.6 34.6 35.46 34.7536.35 35.33 35.95 35.6636.26 34.9 35.39 35.737.9 35 37.67 35.0137.66 36.42 36.64 37.338.29 36.3 36.77 36.6437.58 36 36.85 37.337.32 36.35 36.59 37.2536.89 35.8 35.81 36.5936.41 34.75 35.18 35.936.03 35.18 35.76 35.437.22 35.5 36.66 35.738.55 36.72 38.35 37.0538.65 38.08 38.26 38.4439.17 38.03 38.34 38.2539.2 38.07 38.85 38.541.49 39.08 41.27 39.0842.39 40.68 40.99 41.240.99 40.01 40.7 40.7542.6 40.59 42.28 40.69;candle(a(:,1),a(:,2),a(:,3),a(:,4)candle(a(:,1),a(:,2),a(:,3),a(:,4),r)title(海虹控股);运行结果:盛达矿业MATLAB命令:a=13.11 12.08 13.07 12.212.99 12.65 12.88 12.913.49 12.88 13.19 12.9913.27 12.88 12.98 13.113.1 12.77 12.78 12.9512.77 12.42 12.49 12.712.8 12.42 12.73 12.4212.77 12.32 12.51 12.7213.22 12.5 12.97 12.5113.38 12.95 13.06 13.1513.27 12.46 12.68 12.9813.22 12.65 13.17 12.6814.12 13.22 13.93 13.2914.65 13.7 14.39 13.9514.84 14 14.08 14.3514.35 13.88 14.34 1414.34 13.92 14.19 14.1514.3 14 14.24 14.114.2 13.7 13.74 14.1413.76 13.5 13.57 13.513.9 13.4 13.8 13.514 13.71 13.76 13.7914.01 13.72 13.76 13.813.99 13.5 13.52 13.9113.47 13.2 13.3 13.313.44 13.03 13.28 13.2713.45 13.18 13.44 13.2513.54 13.3 13.37 13.4513.41 13.09 13.28 13.3313.77 13.29 13.74 13.3414.05 13.72 13.93 13.814.23 13.81 14.16 13.9414.2 13.8 13.99 14.0814.8 13.93 14.73 13.9314.95 14.56 14.7 14.78;candle(a(:,1),a(:,2),a(:,3),a(:,4)candle(a(:,1),a(:,2),a(:,3),a(:,4),r)title(盛达矿业);运行结果:恒逸石化MATLAB命令:a=9.6 8.75 9.43 9.049.64 9.1 9.14 9.359.16 8.86 8.99 9.089 8.65 8.67 8.998.85 8.58 8.6 8.588.85 8.38 8.42 8.638.54 8.3 8.49 8.438.57 8.34 8.4 8.58.57 8.4 8.53 8.429.31 8.53 8.97 8.539.38 8.41 8.61 8.78.97 8.63 8.91 8.639.21 8.85 9.11 8.919.25 8.97 9.12 9.119.3 9.01 9.06 9.139.15 8.8 9.14 9.059.27 8.95 9.04 9.19.09 8.74 8.79 9.048.86 8.61 8.7 8.78.85 8.63 8.78 8.728.93 8.25 8.83 8.49.66 8.82 9.37 8.8210.2 9.46 9.47 9.589.9 9.28 9.3 9.479.75 9.25 9.55 9.310.19 9.37 9.89 9.4410.08 9.53 9.69 9.839.71 9.3 9.64 9.69
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 河北省景县2025年上半年公开招聘村务工作者试题含答案分析
- 河北省鸡泽县2025年上半年公开招聘村务工作者试题含答案分析
- 2025版农用车远程监控系统研发与维护服务合同
- 2025版安防监控中心视频监控系统升级改造服务协议
- 2025年度电力系统安全检查工程承包合同样本
- 2025版社区养老服务中心合作协议书
- 2025年度车辆租赁平台与车主合作共赢协议
- 2025年度原木木材贸易代理服务合同
- 2025版地下综合管廊施工合同模板
- 2025厨师创业扶持与合作开发合同范本
- 零售药店培训试题及答案
- 防雷防静电培训考试试题及答案
- 混凝土索赔协议书
- 社保返还协议书
- 2025年湖南省国际工程咨询集团有限公司招聘笔试参考题库附带答案详解
- 中小学违规办学行为治理典型案例与规范要求
- 血液透析中心护士手册
- 高一年级英语学法指导市公开课一等奖省赛课获奖课件
- 2024年《防治煤与瓦斯突出细则》培训课件
- 飞机导线的捆扎与敷设飞机与发动机基本维护课件
- 2024-2025学年人教精通版四年级英语上册全册教案
评论
0/150
提交评论