% Copyright (c) 2001-2009 by Ales Cerny %************************************************************************% % chapter6sect3.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 chapter6sect3.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. % This program implements binomial option pricing model. The log returns % are calibrated to give Poisson jump process in the limit. clear; % clear the workspace clc; % clear screem %***************************% % trading time % % parameters % %***************************% Minute = 1; Hour = 60; HoursInDay = 8; DaysInWeek = 5; DaysInMonth = 21; Day = HoursInDay*Hour; Week = DaysInWeek*Day; Month = DaysInMonth*Day; Year = 12*Month; %***************************% % Hedging Parameters % %***************************% T = 3*Month; % Time to maturity RehedgeInterval = 60 * Minute; % Trading period S0 = 5100; % Initial stock price strike = 5355; %***************************% % Transformation of % % log returns % %***************************% UnitTime = Month; R1safe = 1.0033; % monthly safe return R1 = [1.053 0.965]; % monthly return PDistr = [0.5 0.5]; % prob. density of monthly returns lnR1 = log(R1); % monthly log return mu1 = lnR1 * PDistr'; % expected monthly log return sig1= sqrt(((lnR1-mu1).^2)*PDistr'); % volatility of monthly log return dt = RehedgeInterval/UnitTime; lambda=1.0; dlnS=sig1/sqrt(lambda); mutil=mu1+sqrt(lambda)*sig1; lnRdt=mutil*dt-[0 dlnS]; % log return over rehedging interval % Rdt=exp(lnRdt); Rdtsafe=R1safe^dt; %************************% % Risk-neutral % % probabilities % %************************% QDistr=[Rdtsafe-Rdt(2) Rdt(1)-Rdtsafe]./(Rdt(1)-Rdt(2)); %************************% % grid indexation % %************************% Tidx=ceil(T/RehedgeInterval)+1; % Number of trading dates dlnS=lnRdt(1)-lnRdt(2); % increment on log price grid highlnRdt=lnRdt(1); % the highest return over one period % there are tt live cells at time tt, highest stock price at the top % log price at cell 1 at time tt is ln(S0)+(tt-1)*highlnRdt % log price at cell ii at time tt is ln(S0)+(tt-1)*highlnRdt-(ii-1)*dlnS %************************% % option payoff % %************************% S_T = log(S0)+(Tidx-1)*highlnRdt-(0:(Tidx-1))*dlnS; % log price at maturity S_T = exp(S_T'); % stock price at maturity C = max([(S_T-strike)';zeros(1,length(S_T))]); % option payoff at maturity %************************% % main loop % %************************% tic; % start of computation for tt= Tidx-1:-1:1 Cnext = C; % option value in next period for ii = 1:1:tt C(ii)=(QDistr*Cnext(ii:ii+1)')/Rdtsafe; % risk-neutral pricing end end elapsedtime = toc; disp('____________________________________________________'); disp(' '); disp(sprintf(' no-arbitrage option price at t=0 %12.4f', C(1,1))); disp(' '); disp(sprintf(' option delta at t=0 %12.3f',(Cnext(1)-Cnext(2))/S0/(Rdt(1)-Rdt(2)))); disp(' '); disp(sprintf(' number of trading dates %12.0f', Tidx)); disp(' '); disp(sprintf(' required time in seconds %12.2f', elapsedtime)); disp( '____________________________________________________'); disp(' ');