My bank sells this contract:
If Apple, Coca-Cola, Volkswagen or H&M dont fall more than 50% over the next 3 years i get a return of 35%. 32.4% including commissions.
(Its between the start on 25 June 2012 and end on 25 June 2015. The fall between these two dates should have to be no more than 50%)
If any one of them fall by more than 50% i get my investment reduced by how much the worst stock has fallen.
I tried to calculate the value of such a contract based on historical prices from 1 Jan 1994.
*****************************'
clear
Tot=0;
n=4655-755; % Number of 3-year periods
T1=0; % Number of these which yields a positive return
T2=0; % Number of these which yields a negative return
fid = fopen( 'AppHist2.csv', 'r' );
str = fread( fid, '*char' );
sts = fclose( fid );
str( str == '"' ) = [];
cac = textscan( str, '%f' );
AppH = cell2mat(cac);
for i=1:4655
end
fid2 = fopen( 'CoHist.csv', 'r' );
str2 = fread( fid2, '*char' );
sts2 = fclose( fid2 );
str2( str2 == '"' ) = [];
cac2 = textscan( str2, '%f' );
CoH = cell2mat(cac2);
for i=1:4655
end
fid3 = fopen( 'VwHist4.csv', 'r' ); % Read Volkswagen data
str3 = fread( fid3, '*char' );
sts3 = fclose( fid3 );
str3( str3 == '"' ) = [];
str3( str3 == ',' ) = '.';
cac3 = textscan( str3, '%f' );
VwH = cell2mat(cac3);
for i=1:3416
end
fid4 = fopen( 'HMhist.csv', 'r' ); % Read HM data
str4 = fread( fid4, '*char' );
sts4 = fclose( fid4 );
str4( str4 == '"' ) = [];
str4( str4 == ',' ) = '.';
cac4 = textscan( str4, '%f' );
HmH = cell2mat(cac4);
for i=1:4628
end
P3=1; P4=1;
for i=1:n
% run through the data from 1 jan 1994
K=AppHO(i+755)-AppHO(i);
P=K/AppHO(i);
K2=CoHO(i+755)-CoHO(i);
P2=K2/CoHO(i);
if i>1239
j=i-1239;
K3=VwHO(j+755)-VwHO(j);
P3=K3/VwHO(j);
end
if i>27
k=i-27;
K4=HmHO(k+755)-HmHO(k);
P4=K4/HmHO(k);
end
if (P>=-0.5)&(P2>=-0.5)&(P3>=-0.5)&(P4>=-0.5)
T=9800*1.35;
T1 = T1+1;
else
S=[P P2 P3 P4]
Smin=min(S)
T=9800+9800*Smin
T2 = T2+1;
end
end
T;
Tot = Tot + T;
end
OutcomePerContract=Tot/n
Return=(OutcomePerContract-10000)/10000
NumberPosDays=T1
NumberNegDays=T2
*************************************
OutcomePerContract =
Return =
NumberPosDays =
NumberNegDays =
***********************************************
If anyone has any ideas on how this can be improved (mathematically or the code. Ofc the data is a problem but that was the best i could do. ) or if there is any errors, I am happy to hear about it.