Financial Simulation Hw
Essay Preview: Financial Simulation Hw
Report this essay
Mike PenaProf. Aparna GuptaFinancial SimulationHW091 Implied VolatilityNote: Implied Vol Decreases as option becomes ITM[pic 1][pic 2]2 CEV[pic 3]2 Protective Put[pic 4][pic 5]OUTPUTQ2. Protective Put Initial Cost:230.4262 Payoff per Share: mean (4.7916), sd (6.4967) Profit per Share: mean (1.0354), sd (6.4967) 2 Stop LossOUTPUTQ2. Stop-Loss Cost of Strategy:1.3356MATLAB CODE% First clear the memory and close all open figures:clear all; close all;% Clear the screen:clc;% Change the working directory: This is the working directory% where MATLAB looks for files (data inputs, .m files such as% functions, etc.) and outputs results.cd C:Userspenam2DesktopRPISpring 2017Financial SimulationHomeworkHW09;% If you want to read files from another folder (maybe you% have data stored in another location), you can use the addpath% function:addpath C:Userspenam2DesktopRPISpring 2017Financial SimulationHomeworkHW09;% Quandl authentication tokenQuandl.api_key(xokQnzdREAWG5absGuY3); %% Question 1. Implied Volatility% Obtain Data:stock{1}=GOOG/NYSE_GS;n=length(stock);for i=1:n    data{i}=Quandl.get(stock{i},collapse,monthly,         start_date,2014-1-1,end_date,2017-1-1,type,data);end% Extract prices and compute returns:prices_Dates=data{1}(:,1);prices_GS=data{1}(:,5);returns_Dates=data{1}(1:end-1,1);returns_GS=log(prices_GS(1:end-1,:)./prices_GS(2:end,:));% Compute Statistics:P0_GS=prices_GS(1);Mean_GS=mean(returns_GS(:));Std_GS=std(returns_GS(:));% Obtain Data:stock{1}=GOOG/NYSE_JPM;

n=length(stock);for i=1:n    data{i}=Quandl.get(stock{i},collapse,monthly, …        start_date,2014-1-1,end_date,2017-1-1,type,data);end% Extract prices and compute returns:prices_Dates=data{1}(:,1);prices_JPM=data{1}(:,5);returns_Dates=data{1}(1:end-1,1);returns_JPM=log(prices_JPM(1:end-1,:)./prices_JPM(2:end,:));% Compute Statistics:P0_JPM=prices_JPM(1);Mean_JPM=mean(returns_JPM(:));Std_JPM=std(returns_JPM(:));% Set the variable inputs:% Goldman Sachs CallsS0=226.67;%4/13/2017 @ 11:48AMK_GS=[70,75,80,180,185,190,270,280,290]; r=.02;T=9.2/12; %4/13/2017 – 1/19/2018vol=Std_GS;P=[178.82,172.14,168.9,51.9,50.55,45.1,4.63,3.15,2.2];[m,n]=size(P);Implied_Vol_GS=zeros(m,n);% Option Implied Volatility:% Set the variable inputs:a=0;b=10;x0=2;tol=1e-5;for i=1:n    target=P(i);    K=K_GS(i);    c=@(vol) S0*normcdf((log(S0/K)+(r+(vol^2)/2)*T)/(vol*sqrt(T)))-K*exp(-r*T)*normcdf((log(S0/K)+(r+(vol^2)/2)*T)/(vol*sqrt(T))-(vol*sqrt(T)));    dc=@(vol) (S0*exp(-(log(S0/K) + T*(vol^2/2 + r))^2/(2*T*vol^2))*((2^(1/2)*T^(1/2))/2 – (2^(1/2)*(log(S0/K) + T*(vol^2/2 + r)))/(2*T^(1/2)*vol^2)))/pi^(1/2) + (2^(1/2)*K*exp(-T*r)*exp(-(T^(1/2)*vol – (log(S0/K) + T*(vol^2/2 + r))/(T^(1/2)*vol))^2/2)*(log(S0/K) + T*(vol^2/2 + r)))/(2*T^(1/2)*vol^2*pi^(1/2));    p =@(vol) -S0*normcdf(-((log(S0/K)+(r+(vol^2)/2)*T)/(vol*sqrt(T))))+K*exp(-r*T)*normcdf(-((log(S0/K)+(r+(vol^2)/2)*T)/(vol*sqrt(T))-(vol*sqrt(T))));    dp=@(vol) (S0*exp(-(log(S0/K) + T*(vol^2/2 + r))^2/(2*T*vol^2))*((2^(1/2)*T^(1/2))/2 – (2^(1/2)*(log(S0/K) + T*(vol^2/2 + r)))/(2*T^(1/2)*vol^2)))/pi^(1/2) + (2^(1/2)*K*exp(-T*r)*exp(-(T^(1/2)*vol – (log(S0/K) + T*(vol^2/2 + r))/(T^(1/2)*vol))^2/2)*(log(S0/K) + T*(vol^2/2 + r)))/(2*T^(1/2)*vol^2*pi^(1/2));    % Compute implied Vol for call options:    [ vol0, iter0 ] = myBisection( c, a, b, tol, target );    Implied_Vol_GS(i)=vol0;endfigureplot(K_GS,Implied_Vol_GS);title(Q1. Implied Volatility (GS));xlabel(K) % x-axis labelylabel(Implied Vol) % y-axis label% JP Morgan CallsS0=85.75;%4/13/2017 @ 11:48AMK_JPM=[40,45,57.4,60,75,80,85];r=.02;T=2.1/12; %4/13/2017 – 6/16/2017vol=Std_JPM;P=[47.28,41.99,30.15,27.35,11.91,7.48,3.48];[m,n]=size(P);Implied_Vol_JPM=zeros(m,n);% Option Implied Volatility:% Set the variable inputs:a=0;b=10;x0=2;tol=1e-5;

Get Your Essay

Cite this page

Vol Decreases And 1/19/2018Vol. (June 26, 2021). Retrieved from https://www.freeessays.education/vol-decreases-and-1-19-2018vol-essay/