Start with our simple option pricing program for the dow, putdow.
Write a program to calculate three values for 11 different portfolios.
These portfolios cover fractions of the position with the put option.
Let the fractions vary from 0 to 1 by 0.1. (Use a for loop to do this.)
Use the bootstrap (10,000 iterations) to estimate 3 different values for
each different option position. Find the total cost of the option on the current
day, the expected return on the entire portfolio, and the 1 percent confidence
VaR.
% find VaR for portfolio with at the money put
% option is European put struck at the the current price
% Expiration is in 1 day
% The problem asks for a bootstrap which is not really clear
% This would probably be better done with a historical VaR as in this example here
% load daily dow
load ../data/dow.dat
j = 1; % start counter
for hedgefrac = [0:0.1:1]
% parameters
shares = 100;
options = hedgefrac*shares;
startprice = 1;
strike = startprice; % at the money
% extract price series
p = dow(:,2);
% 1 day arithmetic return
ret1 = (p(2:end)-p(1:end-1))./p(1:end-1);
% 1 day geometric return
ret1g = log ( p(2:end)./p(1:end-1) );
s = std(ret1g);
syear = sqrt(250)*s;
% portfolio value today: black/scholes option value
[coption, poption, delta] = callput(startprice,strike,syear,0.03,1/250);
portvtoday = shares*startprice + options*poption;
portvtoday
poption
% vector of values 1 day from now
port1day = shares*startprice*(ret1+1) + ...
options*max( strike - startprice*(1+ret1),0);
% find historical var using direct percentile on portfolio values
% report the oposite of the loss
var95(j) = portvtoday - quantile(port1day,0.05)
pret(j) = (mean(port1day)-portvtoday)/portvtoday;
optcost(j) = options*poption;
j = j+1; % increment counter
end