MATLAB金融計算試題_第1頁
MATLAB金融計算試題_第2頁
MATLAB金融計算試題_第3頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、datestr(curvedates) plot(zerorates) 運行結(jié)果:zerorates =0.01150.01180.01680.03020.04180.0550curvedates =735341735432735964737014738840745507MATLA金融計算試題(2014級研究生用)(上機操作使用)、利率期限結(jié)構(gòu)(20 分)已知國債面值是100美元,各期收益率為國債品種票息到期日當(dāng)期收益3個月17-Apr-20131.156個月17-Jul-20131.182年1.7531-Dec-20141.685年3.0015-Nov-20172.9710年4.0015-N

2、ov-20224.0130年5.37515-Feb-20414.92試分析其利率期限結(jié)構(gòu)。MATLAB命 令:bo nds=date num('04/17/2013') 0100;date num('07/17/2013') 0100;datenum('12/31/2014') 0.0175 100;datenum('11/15/2017') 0.03100;datenum('11/15/2022') 0.04100;datenum('02/15/2041') 0.0537 100;yield=0.

3、0115 0.0118 0.0168 0.0297 0.0401 0.0492' settle=date num('01/17/2013'); %結(jié)算日zerorates,curvedates=zbtyield(b on ds,yield,settle)0.055 ,1,1c1,0.05-0.045-0.04 -/-0.0350.030.0250.02-0.015-0.01 !1111cJ111.522.533.544.555.56ans = 17-Apr-201317-Jul-201331-Dec-201415-Nov-201715-Nov-202215-Feb-20

4、41二、期權(quán)定價(30分)若股票現(xiàn)在價格為$50,期權(quán)執(zhí)行價格為$52,無風(fēng)險利率為0.1,股票波動標(biāo)準(zhǔn)差為 期權(quán)的到期日為6個月,且若這一賣權(quán)在3.5月時有一次股息支付$2。(1) 使用Black-Scholes定價公式計算歐式賣權(quán)和買權(quán)的價值;MATLAB命 令:price=50;strike=52;rate=0.1;time=6/12;volatility=0.4;callprice,putprice=blsprice(price,strike,rate,time,volatility)運行結(jié)果:callprice =5.8651putprice =5.3290(2) 利用二項式期權(quán)定價

5、(二叉樹(CRR模型定價數(shù)值解)計算看漲看跌期權(quán)價格MATLAB命 令:price=50;strike=52;rate=0.1;time=6/12;in creme nt=1/12;volatility=0.4;flag=0;divide ntrate=0;divide nt=2;exdiv=3.5;price,optio n=bi nprice(price,strike,rate,time,i ncreme nt,volatility,flag,divide ntrate,divide nt,exdiv)運行結(jié)果:得岀二叉樹每個交點處的資產(chǎn)價格和期權(quán)價值price =50.0000 55.8

6、985 62.5172 69.9441 76.2699 85.6054 96.08360 44.7755 50.0326 55.9315 60.5420 67.9524 76.269900 40.1226 44.8084 48.0575 53.9398 60.5420000 35.9790 38.1474 42.8167 48.0575000030.2809 33.9873 38.147400000 26.9787 30.2809000000 24.0366optio n =6.70163.93081.76520.459800009.66866.22753.13930.94120000 13.

7、37629.51325.45601.926300 00 00 00 00 17.5811 13.8526 9.1833 3.94250021.7191 18.0127 13.8526000 25.0213 21.7191由結(jié)果可知,option第一行第一列就是看跌期權(quán)價格,該期權(quán)價格為6.7016 兀。000 0 27.9634MATLAB命令: price=50; strike=52;rate=0.1; time=6/12; in creme nt=1/12; volatility=0.4; flag=1;divide ntrate=0;divide nt=2;exdiv=3.5;price

8、,opti on=bin price(price,strike,rate,time,i ncreme nt,volatility,flag,divide ntrate,divide nt,exdiv)運行結(jié)果:得出二叉樹每個交點處的資產(chǎn)價格和期權(quán)價值.price =50.0000 55.8985 62.5172 69.9441 76.2699 85.6054 96.08360 44.7755 50.0326 55.9315 60.5420 67.9524 76.269900 40.1226 44.8084 48.0575 53.9398 60.5420000 35.9790 38.1474 4

9、2.8167 48.0575000 030.2809 33.9873 38.1474000 00 26.9787 30.2809000 000 24.0366optio n =4.99967.879212.086417.9441 25.1294 34.0369 44.083602.1193 3.68096.2599 10.3427 16.3840 24.2699000.54731.08782.16224.29768.54200000000000000000000000000000由結(jié)果可知,option第一行第一列就是看漲期權(quán)價格,該期權(quán)價格為 4.9996元。(3) 假設(shè)股票價格服從幾何布朗

10、運動,試用蒙特卡洛模擬方法計算該期權(quán)價格。MATLAB命令:s0=50;K=52;r=0.1;T=0.5;sigma=0.4; Nu=1000;randn( 'seed' ,0);%定義隨機數(shù)發(fā)生器種子是0,%這樣保證每次模擬的結(jié)果相同n uT=(r-0.5*sigmaA2)*Tsit=sigma*sqrt(T) discpayoff=exp(-r*T)*max(0,s0*exp( nuT+sit*ra ndn (Nu,1)-K);%期權(quán)到期時的現(xiàn)金流eucall,varprice,ci=no rmfit(discpayoff)運行結(jié)果:nuT =0.0100sit =0.28

11、28eucall =6.1478varprice =10.2924ci =5.50916.7865三、搜集數(shù)據(jù)并計算畫圖(50分)按照自己的研究生學(xué)號后兩位數(shù),在銳思金融數(shù)據(jù)庫中搜集 4種股票信息,包括最高價、最低價、收盤價和開盤價,數(shù)據(jù)個數(shù)2個月左右,建立數(shù)據(jù)表格。要求使用MATLAB編程解決以下問題:(1) 將4種股票的收盤價格轉(zhuǎn)化為收益率,并畫出收益率直方圖 海虹控股MATLAB命 令:TickSeries=31.63 32.17 31.58 30.71 30.77 30.93 31.79 31.58 3233.91 33.12 34.98 35.3 35.5 34.65 35.46 3

12、5.95 35.39 37.6736.64 36.77 36.85 36.59 35.81 35.18 35.76 36.66 38.35 38.2638.34 38.85 41.27 40.99 40.7 42.28'RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天數(shù)');ylabel('收益率'); title('海虹控股對數(shù)收益率直方圖');運行結(jié)果:RetSeries =0.0171-0.0183-0.02750.0020率 益 收海虹控股對數(shù)收益率直方圖天數(shù)0.00520

13、.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盛達(dá)礦業(yè)MATLAB命令:TickSeries=13.07 12.88 13.19 12.98 12.78 12.49 12.73 12.51 12.9713.06 12.68 13.17 13.93 14.39 14.08 14.

14、34 14.19 14.24 13.7413.57 13.813.76 13.76 13.52 13.313.28 13.44 13.37 13.2813.74 13.93 14.16 13.99 14.73 14.7'RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天數(shù));ylabel('收益率');title('盛達(dá)礦業(yè)對數(shù)收益率直方圖');運行結(jié)果:RetSeries =-0.01450.02410.06-0.01590.05-0.01540.04-0.02270.01920.03-0

15、.01730.03680.0069率益收02-0.02910.03860.05770.0330-0.01-0.02-0.03-0.02150.01850510152025天數(shù)3035盛達(dá)礦業(yè)對數(shù)收益率直方圖-0.04-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命令:8.6 8.428.498.4 8.538.97TickSeries=9.43 9.148.998.678.919.1

16、19.129.069.149.048.798.7 8.788.839.479.3 9.559.899.699.649.589.529.8810.228.619.3710.310.45 10.84'RetSeries=tick2ret(TickSeries)bar(RetSeries)xlabel('天數(shù));ylabel('收益率'); title('恒逸石化對數(shù)收益率直方圖);運行結(jié)果:RetSeries =-0.03080.08-0.0164-0.0356-0.0081-0.02090.0083-0.0106率益收0.0155-0.020.0516-0

17、.0401-0.040.03480.02240.0011-0.0605101520天數(shù)2530350.060.04恒逸石化對數(shù) 收益率 直方圖020-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.9 11.17 11.32 11.32 11.22 11.08 11.27 11.19 11.3111.52 11.25 11.

18、78 12.07 12.11 12.15 12.29 12.45 12.87 12.7712.63 12.56 12.71 12.71 12.512.15 12.23 12.12 12.48 12.612.87 12.913.33 13.513.513.42'RetSeries=tick2ret(TickSeries) bar(RetSeries)xlabel('天數(shù));ylabel('收益率'); title('金宇車城對數(shù)收益率直方圖);運行結(jié)果:RetSeries =0.02480.01340-0.0088-0.01250.0171-0.00710

19、.01070.0186-0.02340.04710.02460.00330.0033 0.0115 0.0130 0.0337-0.0078-0.0110-0.00550.0119 0 -0.0165 -0.02800.0066 -0.00900.02970.00960.02140.00230.03330.01280-0.0059(2)計算4種股票收盤價的協(xié)方差矩陣;MATLAB命 令:A=31.6313.07 9.4310.932.1712.889.1411.1731.5813.198.9911.3230.7112.988.6711.3230.7712.788.6 11.2230.9312.

20、498.4211.0831.7912.738.4911.2731.5812.518.4 11.1932 12.97 8.5311.3133.9113.068.9711.5233.1212.688.6111.2534.9813.178.9111.7835.313.939.1112.0735.514.399.1212.1134.6514.089.0612.1535.4614.349.1412.2935.9514.199.0412.4535.3914.248.7912.8737.6713.748.7 12.7736.6413.578.7812.6336.7713.88.8312.5636.8513.

21、769.3712.7136.5913.769.4712.7135.8113.529.3 12.535.1813.39.5512.1535.7613.289.8912.2336.6613.449.6912.1238.3513.379.6412.4838.2613.289.5812.638.3413.749.5212.8738.8513.939.8812.941.2714.1610.2213.3340.9913.9910.313.540.714.7310.4513.542.2814.710.8413.42cov(A)運行結(jié)果:ans =10.06081.47511.56872.30591.4751

22、0.37110.22700.38571.56870.22700.36820.33262.30590.38570.33260.5837(3) 若給出這4種股票預(yù)期收益率分別為0.3、0.25、0.2和0.15,且購買權(quán)重分別0.35、0. 25、0.25和0.15,求總資產(chǎn)的標(biāo)準(zhǔn)差和期望收益;MATLAB命令:ExpReturn=0.3,0.25,0.2,0.15;ExpCovaria nce= 10.06081.47511.56872.30591.4751 0.37110.22700.38571.5687 0.22700.36820.33262.3059 0.38570.33260.5837;

23、PortWts=0.35 0.25 0.25 0.15;PortRisk,PortReturn=portstats(ExpReturn, ExpCovaria nce,PortWts)運行結(jié)果:PortRisk =1.4659PortReturn =0.2400(4) 求該資產(chǎn)組合有效前沿(有效前沿的個數(shù)選為5);MATLAB命 令:ExpReturn=0.3 0.25 0.2 0.15;ExpCovaria nce=10.06081.47511.56872.30591.4751 0.37111.5687 0.22702.3059 0.3857NumPorts=5;0.22700.38570.

24、36820.33260.33260.5837PortR in k,PortRetur n,PortWts=fr ontcon (ExpReturn,ExpCovaria nce,NumPorts)運行結(jié)果:PortRi nk =0.5462 0.5820 1.17292.15853.1719PortReturn =0.22470.24360.2624 0.28120.3000PortWts =-0.0000 0.4949 0.50510.000000.87120.1288 -0.00000.24750.75250-0.00000.6237 0.37630-0.00001.0000 0 0.00

25、00 -0.00003,求考慮無風(fēng)險(5) 無風(fēng)險利率為0.35,借貸利率為0.5,投資者風(fēng)險厭惡系數(shù)為資產(chǎn)及借貸情況下的最優(yōu)資產(chǎn)配置。MATLAB命 令:ExpReturn=0.3 0.25 0.2 0.15;ExpCovaria nce=10.06081.47511.56872.30591.4751 0.37110.22700.38571.5687 0.22700.36820.33262.3059 0.38570.33260.5837;RisklessRate=0.035;BorrowRate=0.5;RiskAversio n=3;PortRisk,PortReturn,PortWts=

26、portopt(ExpReturn,ExpCovaria nee) RiskyRi nk, RiskyReturn, RiskyWts, RiskyFractio n,0 verallRick, OverallReturn=portalloc(PortRisk,.PortRetur n, PortWts, RisklessRate,BorrowRate, RiskAversio n) 運行結(jié)果:PortRisk =0.54620.55340.57470.60840.96631.38641.82462.27042.72003.1719PortReturn =0.22470.23310.24150

27、.24980.25820.26660.27490.28330.29160.3000PortWts =-0.00000.49490.50510.00000 10.6621 10.3379-0.00000.00000.82940.1706 -0.00000 10.9966 10.0034-0.00000.16380.83620-0.00000.33110.668900.00000.49830.50170-0.00000.66550.33450-0.00000.83280.167200.00001.0000 0 0.0000 -0.0000RiskyRi nk =0.5427RiskyReturn

28、=0.2302RiskyWts =-0.0000 0.6040 0.3960 -0.0000RiskyFract ion =0.2209OverallRick =0.1199OverallReturn =0.0781(6) 繪制這4種股票的最高價、最低價、收盤價和開盤價的燭型圖。海虹控股MATLAB命令a=31.9 30.5431.6331.2932.35 30.7132.1731.332.631.5631.5832.0832 30.730.71 31.8231.59 30.45 30.77 30.5531.230 30.93 30.632.230.9431.7930.9432.1831.52

29、31.5831.7832.1131.4332 31.633.9131.9133.9132.135.5732.533.1232.8335.433.2634.9833.2635.5734.2835.334.9636.4935.135.535.335.834.4534.6535.335.634.635.4634.7536.3535.3335.9535.6636.2634.935.3935.737.935 37.67 35.0137.6636.4236.6437.338.2936.336.7736.6437.5836 36.85 37.337.3236.3536.5937.2536.8935.835.

30、8136.5936.4134.7535.1835.936.0335.1835.7635.437.22 35.536.66 35.738.5536.7238.3537.0538.6538.0838.2638.4439.1738.0338.3438.2539.238.0738.8538.541.4939.0841.2739.0842.3940.6840.9941.240.9940.0140.740.7542.640.5942.2840.69;can dle(a(:,1),a(:,2),a(:,3),a(:,4)can dle(a(:,1),a(:,2),a(:,3),a(:,4),'r&#

31、39;)title('海虹控股');運行結(jié)果:盛達(dá)礦業(yè)MATLAB命令:a=13.1112.08 13.07 12.212.9912.6512.8812.913.4912.8813.1912.9913.2712.8812.9813.113.112.7712.7812.9512.7712.4212.4912.712.812.4212.7312.4212.7712.3212.5112.7213.2212.512.9712.5113.3812.9513.0613.1513.2712.4612.6812.9813.2212.6513.1712.6814.1213.2213.9313.2

32、914.6513.714.3913.9514.84 14 14.08 14.3514.35 13.88 14.34 1414.3413.9214.1914.1514.314 14.24 14.114.213.713.7414.1413.7613.513.5713.513.913.413.813.514 13.71 13.76 13.7914.0113.7213.7613.813.9913.513.5213.9113.4713.213.313.313.4413.0313.2813.2713.4513.1813.4413.2513.5413.313.3713.4513.4113.0913.2813

33、.3313.7713.2913.7413.3414.0513.7213.9313.814.2313.8114.1613.9414.213.813.9914.0814.813.9314.7313.9314.9514.5614.714.78can dle(a(:,1),a(:,2),a(:,3),a(:,4)can dle(a(:,1),a(:,2),a(:,3),a(:,4),'r')title('盛達(dá)礦業(yè)');運行結(jié)果:恒逸石化MATLAB命令:a=9.6 8.759.439.049.649.1 9.149.359.168.868.999.089 8.658.678.998.858.588.6 8.588.858.388.428.638.548.3 8.498.438.578.348.4 8.510.35;'r')9.318.538.978.539.388.418.618.78.978.638.918.639.218.859.118.919.258.979.129.119.3 9.019.069.139.158.8 9.149.059.278.959.049.19.098.748.799.048.868.618.7 8.78.858.638.788.728.938.258.838.49.668.829.378.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論