MATLAB金融計(jì)算試題_第1頁(yè)
MATLAB金融計(jì)算試題_第2頁(yè)
MATLAB金融計(jì)算試題_第3頁(yè)
MATLAB金融計(jì)算試題_第4頁(yè)
MATLAB金融計(jì)算試題_第5頁(yè)
已閱讀5頁(yè),還剩23頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、MATLAB金融計(jì)算試題(級(jí)研究生用)(上機(jī)操作使用)一、利率期限構(gòu)造(20分) 已知國(guó)債面值是100美元,各期收益率為國(guó)債品種票息到期日當(dāng)期收益3個(gè)月17-Apr-1.156個(gè)月17-Jul-1.182年1.7531-Dec-1.685年3.0015-Nov-2.974.0015-Nov-20224.0130年5.37515-Feb-20414.92 試分析其利率期限構(gòu)造。MATLAB命令: bonds=datenum(04/17/) 0 100; datenum(07/17/) 0 100; datenum(12/31/) 0.0175 100; datenum(11/15/) 0.03

2、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/); %結(jié)算日 zerorates,curvedates=zbtyield(bonds,yield,settle) datestr(curvedates) plot(zerorates)運(yùn)營(yíng)成果:zerorates = 0.0115 0.0118 0.0168 0.0302 0.0418 0.0550curvedates =

3、 735341 735432 735964 737014 738840 745507ans =17-Apr-17-Jul-31-Dec-15-Nov-15-Nov-202215-Feb-2041二、期權(quán)定價(jià)(30分)若股票目前價(jià)格為$50,期權(quán)執(zhí)行價(jià)格為$52,無(wú)風(fēng)險(xiǎn)利率為0.1,股票波動(dòng)原則差為0.4,期權(quán)旳到期日為6個(gè)月,且若這一賣(mài)權(quán)在3.5月時(shí)有一次股息支付$2。使用Black-Scholes定價(jià)公式計(jì)算歐式賣(mài)權(quán)和買(mǎi)權(quán)旳價(jià)值;MATLAB命令:price=50;strike=52;rate=0.1;time=6/12;volatility=0.4;callprice,putprice=b

4、lsprice(price,strike,rate,time,volatility)運(yùn)營(yíng)成果:callprice = 5.8651putprice = 5.3290運(yùn)用二項(xiàng)式期權(quán)定價(jià)(二叉樹(shù)(CRR)模型定價(jià)數(shù)值解)計(jì)算看漲看跌期權(quán)價(jià)格;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,volati

5、lity,flag,dividentrate,divident,exdiv)運(yùn)營(yíng)成果:得出二叉樹(shù)每個(gè)交點(diǎn)處旳資產(chǎn)價(jià)格和期權(quán)價(jià)值.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

6、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第一行第一列就是看跌期權(quán)價(jià)格,該期權(quán)價(jià)格為6.701

7、6元。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)運(yùn)營(yíng)成果:得出二叉樹(shù)每個(gè)交點(diǎn)處旳資產(chǎn)價(jià)格和期權(quán)價(jià)值.price = 50.0000 55.8985 62.5172 69.9441 76.2699 85.6

8、054 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

9、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第一行第一列就是看漲期權(quán)價(jià)格,該期權(quán)價(jià)格為4.9996元。 (3) 假設(shè)股票價(jià)格服從幾何布朗運(yùn)動(dòng),試用蒙特卡洛模擬措施計(jì)算該期權(quán)價(jià)格。MATLAB命令:s0=50;K=52;r=0.1;T=0.5;sigma=0.4;Nu=1000;randn(seed,0); %定義隨機(jī)數(shù)發(fā)生器種子是0, %這樣保證每次模擬旳成果相似nu

10、T=(r-0.5*sigma2)*Tsit=sigma*sqrt(T)discpayoff=exp(-r*T)*max(0,s0*exp(nuT+sit*randn(Nu,1)-K);%期權(quán)到期時(shí)旳鈔票流eucall,varprice,ci=normfit(discpayoff)運(yùn)營(yíng)成果:nuT = 0.0100sit = 0.2828eucall = 6.1478varprice = 10.2924ci = 5.5091 6.7865三、收集數(shù)據(jù)并計(jì)算畫(huà)圖(50分)按照自己旳研究生學(xué)號(hào)后兩位數(shù),在銳思金融數(shù)據(jù)庫(kù)中收集4種股票信息,涉及最高價(jià)、最低價(jià)、收盤(pán)價(jià)和開(kāi)盤(pán)價(jià),數(shù)據(jù)個(gè)數(shù)2個(gè)月左右,建立數(shù)

11、據(jù)表格。規(guī)定使用MATLAB編程解決如下問(wèn)題:將4種股票旳收盤(pán)價(jià)格轉(zhuǎn)化為收益率,并畫(huà)出收益率直方圖海虹控股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(Tick

12、Series)bar(RetSeries)xlabel(天數(shù));ylabel(收益率);title(海虹控股對(duì)數(shù)收益率直方圖);運(yùn)營(yíng)成果: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.013

13、3 0.0623 -0.0068 -0.0071 0.0388盛達(dá)礦業(yè)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(RetS

14、eries)xlabel(天數(shù));ylabel(收益率);title(盛達(dá)礦業(yè)對(duì)數(shù)收益率直方圖);運(yùn)營(yíng)成果: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.012

15、0 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(天數(shù));ylabel(收益率);title(恒逸石化對(duì)數(shù)收益率直方圖)

16、;運(yùn)營(yíng)成果: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金宇車(chē)城MATLAB命令:TickSeries=10.9

17、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(天數(shù));ylabel(收益率);title(金宇車(chē)城對(duì)數(shù)收益率直方圖);運(yùn)營(yíng)成果:RetSeries

18、 = 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計(jì)算4種股票收盤(pán)價(jià)旳協(xié)方差矩陣;MATLAB命令:A=31.63 13.07 9.43 10.932.17 12.88 9.14

19、 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.1

20、4 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

21、.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)運(yùn)營(yíng)成果: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若給出這4種股票預(yù)期收益率分別為0.3、0.25、0.2和0.15,且購(gòu)買(mǎi)權(quán)重分別0.35、0. 25、0.

22、25和0.15,求總資產(chǎn)旳原則差和盼望收益;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)運(yùn)營(yíng)成果:PortRisk = 1.4659

23、PortReturn = 0.2400求該資產(chǎn)組合有效前沿(有效前沿旳個(gè)數(shù)選為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)運(yùn)營(yíng)成果:PortRink

24、 = 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無(wú)風(fēng)險(xiǎn)利率為0.35,借貸利率為0.5,投資者風(fēng)險(xiǎn)厭惡系數(shù)為3,求考慮無(wú)風(fēng)險(xiǎn)資產(chǎn)及借貸狀況下旳最優(yōu)資產(chǎn)配備。MATLAB命令:ExpReturn=0.3 0.25

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,Overall

26、Rick, OverallReturn=portalloc(PortRisk,.PortReturn, PortWts, RisklessRate,BorrowRate, RiskAversion)運(yùn)營(yíng)成果: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.

27、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.000

28、0RiskyFraction = 0.2209OverallRick = 0.1199OverallReturn = 0.0781(6)繪制這4種股票旳最高價(jià)、最低價(jià)、收盤(pán)價(jià)和開(kāi)盤(pán)價(jià)旳燭型圖。海虹控股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.

29、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.25

30、36.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

31、)candle(a(:,1),a(:,2),a(:,3),a(:,4),r)title(海虹控股);運(yùn)營(yíng)成果:盛達(dá)礦業(yè)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 1

32、2.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

33、 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(:

34、,4),r)title(盛達(dá)礦業(yè));運(yùn)營(yíng)成果:恒逸石化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.

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論