您好,欢迎访问三七文档
当前位置:首页 > 金融/证券 > 金融资料 > MATLAB金融计算试题
...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')0100;datenum('07/17/2013')0100;datenum('12/31/2014')0.0175100;datenum('11/15/2017')0.03100;datenum('11/15/2022')0.04100;datenum('02/15/2041')0.0537100];yield=[0.01150.01180.01680.02970.04010.0492]';settle=datenum('01/17/2013');%结算日[zerorates,curvedates]=zbtyield(bonds,yield,settle)datestr(curvedates)plot(zerorates)运行结果:zerorates=0.01150.01180.01680.03020.04180.0550curvedates=73534173543273596473701473884074550711.522.533.544.555.560.010.0150.020.0250.030.0350.040.0450.050.055...ans=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.000055.898562.517269.944176.269985.605496.0836044.775550.032655.931560.542067.952476.26990040.122644.808448.057553.939860.5420...00035.979038.147442.816748.0575000030.280933.987338.14740000026.978730.280900000024.0366option=6.70163.93081.76520.459800009.66866.22753.13930.9412000013.37629.51325.45601.9263000017.581113.85269.18333.9425000021.719118.012713.85260000025.021321.719100000027.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.000055.898562.517269.944176.269985.605496.0836044.775550.032655.931560.542067.952476.26990040.122644.808448.057553.939860.542000035.979038.147442.816748.0575000030.280933.987338.14740000026.978730.280900000024.0366option=4.99967.879212.086417.944125.129434.036944.083602.11933.68096.259910.342716.384024.2699000.54731.08782.16224.29768.54200000000000000000000000000000...由结果可知,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*sigma^2)*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.50916.7865三、搜集数据并计算画图(50分)按照自己的研究生学号后两位数,在锐思金融数据库中搜集4种股票信息,包括最高价、最低价、收盘价和开盘价,数据个数2个月左右,建立数据表格。要求使用MATLAB编程解决以下问题:(1)将4种股票的收盘价格转化为收益率,并画出收益率直方图海虹控股MATLAB命令:TickSeries=[31.6332.1731.5830.7130.7730.9331.7931.583233.9133.1234.9835.335.534.6535.4635.9535.3937.6736.6436.7736.8536.5935.8135.1835.7636.6638.3538.2638.3438.8541.2740.9940.742.28]';RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天数');ylabel('收益率');title('海虹控股对数收益率直方图');运行结果:...RetSeries=0.0171-0.0183-0.02750.00200.00520.0278-0.00660.01330.0597-0.02330.05620.00910.0057-0.02390.02340.0138-0.01560.0644-0.02730.00350.0022-0.0071-0.0213-0.01760.01650.02520.0461-0.00230.00210.01330.0623-0.0068-0.00710.0388盛达矿业MATLAB命令:TickSeries=[13.0712.8813.1912.9812.7812.4912.7312.5112.9713.0612.6813.1713.9314.3914.0814.3414.1914.2413.7413.5713.813.7613.7613.5213.313.2813.4413.3713.2813.7413.9314.1613.9914.7314.7]';RetSeries=tick2ret(TickSeries)bar(RetSeries)05101520253035-0.03-0.02-0.0100.010.020.030.040.050.060.07天数收益率海虹控股对数收益率直方图...xlabel('天数');ylabel('收益率');title('盛达矿业对数收益率直方图');运行结果:RetSeries=-0.01450.0241-0.0159-0.0154-0.02270.0192-0.01730.03680.0069-0.02910.03860.05770.0330-0.02150.0185-0.01050.0035-0.0351-0.01240.0169-0.00290-0.0174-0.0163-0.00150.0120-0.0052-0.00670.03460.01380.0165-0.01200.0529-0.0020恒逸石化MATLAB命令:TickSeries=[9.439.148.998.678.68.428.498.48.538.978.618.919.119.129.069.149.048.798.78.788.839.379.479.39.559.899.699.649.589.529.8810.2210.310.4510.84]';05101520253035-0.04-0.03-0.02-0.0100.010.020.030.040.050.06天数收益率盛达矿业对数收益率直方图...RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天数');ylabel('收益率');title('恒逸石化对数收益率直方图');运行结果:RetSeries=-0.0308-0.0164-0.0356-0.0081-0.02090.0083-0.01060.01550.0516-0.04010.03480.02240.0011-0.00660.0088-0.0109-0.0277-0.01020.00920.00570.06120.0107-0.01800.02690.0356-0.0202-0.0052-0.0062-0.00630.03780.03440.00780.01460.0373金宇车城MATLAB命令:TickSeries=[10.911.1711.3211.3211.2211.0811.2711.1911.3111.5211.2511.7812.0712.1112.1512.2905101520253035-0.06-0.04-0.0200.020.040.060.08天数收益率恒逸石化对数收益率直方图...12.4512.8712.7712.6312.5612.7112.7112.512.1512.2312.1212.4812.612.8712.913.3313.513.513.42]';RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天数');ylabel('收益率');t
本文标题:MATLAB金融计算试题
链接地址:https://www.777doc.com/doc-7288227 .html