% Copyright (c) 2001-2009 by Ales Cerny %************************************************************************% % chapter3sect9.m - supplementary program to % % Ales Cerny (2009) Mathematical Techniques in Finance (2nd ed.) % % Princeton University Press http://press.princeton.edu/titles/9079.html % %************************************************************************% % This code is provided 'as-is', without any express or implied warranty. % % Permission is granted to anyone to use this code for any purpose, % subject to the following restrictions: % % 1. The origin of this code must not be misrepresented; you must not % claim that you wrote the original code. % 2. Modified code versions must be plainly marked as such, and must not % be misrepresented as being the original code. % 3. This notice may not be removed from any source distribution. % NOTICE TO STUDENTS: To avoid accusations of plagiarism, if you use this % code or its modifications in assessed work you should prepend it with a % note stating: % "This is the original/modified version of the code chapter3sect9.m by % Ales Cerny (2009), Mathematical Techniques in Finance (2nd ed.), % Princeton University Press. The original version is available from % http://www.martingales.info/mtfweb2". % A similar acknowledgement should appear prominently inside your written % report. % One year horizon, NIKKEI 225 real returns clear; clc; format short; %*******************% % parameters % %*******************% Risky1 = -0.35 : 0.05 : 0.90; % row vector of rates of return from -35% to 90% in 5% increments% XDistr = [0.011 % relative frequency of annual real returns on NIKKEI 225, monthly data 1960-2000 0.023 0.021 0.041 0.034 0.061 0.112 0.095 0.097 0.081 0.091 0.068 0.074 0.049 0.047 0.028 0.015 0.008 0.013 0.021 0.000 0.000 0.004 0.000 0.002 0.004 ]'; strike = 1.1; SafeRate = 0.02; vol = sqrt((log(1+Risky1).^2)*XDistr'-(log(1+Risky1)*XDistr')^2); Risky2 = max([zeros(1,length(Risky1));((1+Risky1)-strike)]); BSprice2 = BScall(1,strike,SafeRate,1,vol); price2 =[-0.1; 0.1; 0.5; 0.75; 0.9; 1]*BSprice2; IPPrecisionTolerance = 10^-6; %****************************% % main body of the programme % %****************************% SR = zeros(length(price2),1); beta = zeros(length(price2),1); SRm = zeros(length(price2),1); betam = zeros(length(price2),1); suboptSRm = zeros(length(price2),1); for ii = 1 : 1 : length(price2); X = (Risky2/price2(ii)-1-SafeRate); EX = X*XDistr'; OmegaX = (X.*XDistr)*X'; % OmegaX = E[XX'] [IPm,betam(ii)]=TrQUmax(X, XDistr, IPPrecisionTolerance); SRm(ii)=sqrt((1-IPm)^-2-1); beta(ii)=inv(OmegaX)*EX; SR(ii)=sqrt(1/(1-EX'*beta(ii))-1); suboptSRm(ii)=SRmvalue(X, XDistr, beta(ii)); end; disp(' ______________________________________________________________________________________________________________________ '); disp(' '); disp(' '); disp(sprintf(' option price %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f',price2')); disp(' '); disp(sprintf(' standard beta %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f',beta')); disp(' '); disp(sprintf(' arbitrage-adj beta %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f',betam')); disp(' '); disp(sprintf(' standard SR %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f',SR')); disp(' '); disp(sprintf(' arb-adj SR of std beta %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f',suboptSRm')); disp(' '); disp(sprintf(' arbitrage-adj SR %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f',SRm')); disp(' '); disp(' _______________________________________________________________________________________________________________________ '); disp(' '); disp(' ');