Category Archives: codes, tools

Matlab Code for Garch FX Call Option Pricing with Monte Carlo

 

Garch FX Call Option Pricing with Monte Carlo Put your data where you see XX..
 
GARCHCall=zeros(XX,1);%Put number of data set
 
%Garch parameters
 
alpha0= XX; %Put your Garch-Model alpha0
 
alpha1= XX; %Put your Garch-Model alpha1
 
beta1=0 XX; %Put your Garch-Model beta1
 
lambda = XX; %Put your Garch-Model lambda
 
N = XX;      % Maturity in days.
 
T = N/365;    % Maturity in years.
 
variance = alpha0 / (1 - alpha1*(1+lambda^2) - beta1); %Implied variance calculation
 
sigma = sqrt(variance)*sqrt(365); %Standart deviation
 
for  z=1:XX;
 
rdif=(ird(z,1))/36500;%Interest rate differential
 
Spot = spot(z,1);   % Spot
 
K = atmusd(z,1);       %Strike price
 
Nsims = 3000;  % Number of simulations
 
S = zeros(N,Nsims);
 
S(1,:) = Spot;
 
e(1) = 0;
 
h(1) = variance;
 
% Simulate paths for the stock price, and retain the terminal prices S(T).
 
for i.html">i=1:Nsims;
 
for t=2:N
 
h(t) = alpha0 + alpha1*(e(t-1) - lambda*sqrt(h(t-1)))^2 + beta1*h(t-1);
 
e(t) = sqrt(h(t))*randn(1);
 
S(t,i.html">i) = S(t-1,i.html">i)*exp(rdif - 0.5*h(t) + e(t));
 
end
 
ST(i.html">i) = S(end,i.html">i);
 
end
 
GARCHCall (z,1)= (exp(-(rf (z,1)/100)*T)*mean(max(ST-K,0)))*100; %Garch Call Option Price
 
end

 



COGARCH Option Pricing

 

Cogarch option pricing model

Cogarch



CRR Option Pricing

It might seem as just arithmetics,yet use of Cox-Ross-Rubinstein option pricing has been a fundamental step in option pricing.

Attached is an excel for option pricing with CRR model.

crr



Basic application of mean-variance porfolio optimization with matlab

Basic application of mean-variance portfolio optimization with matlab

% Basic application of mean-variance portfolio optimization with using
% Frontcon function of matlab .
%input
selected_assetprices
%return of assets
AR=price2ret(selected_assetprices);
%expected return of asset
ER=mean(AR);
%covariance matrix of asset returns
CM=cov(AR);
%target portfolio return
PR= 0.10  % your target return
%number of portfolio contructed
N=10
%portfolio optimization
PO=frontcon(ER,CM,N,PR)


Lookback Option Pricing

Pricing excel for Lookback call and put options with fixed strike prepared by myself…

LBFK