Code covered by the BSD License
-
blsvis(varargin)
BLSVIS M-file for blsvis.fig
-
dfdb_port_opt(varargin)
DF_PORT_OPT Datafeed Portfolio Optimizer - Graphical User Interface.
-
PortVaRmc(nsim)
portfolio VaR using Monte Carlo
-
blsimpv(so,x,r,t,call,maxiter...
BLSIMPV Black-Scholes implied volatility.
-
bondprice2spread(varargin)
BONDPRICE2SPREAD: Static Spread to a reference spot curve.
-
excelget(FileName, SheetNo, R...
EXCELGET Load Excel data into MATLAB.
-
excelget(FileName, SheetNo, R...
EXCELGET Load Excel data into MATLAB.
-
excelget(FileName, SheetNo, R...
EXCELGET Load Excel data into MATLAB.
-
garchFXdemo
GARCH(1,1) Foreign Exchange (FX) Simulation/Estimation Demo.
-
montecarlo(iVal,mRet,volat,t,...
MONTECARLO Monte-Carlo Simulation.
-
multimc(hVal,t,nSim)
-
oprice
-
oprice
-
optrisk
Delta-gamma VaR estimation on Portfolio Data
-
termfit(...
TERMFIT Fitted smoothed zero curve from coupon bond prices.
-
zbtprice(Bonds, Prices, Settl...
ZBTPRICE An updated Zero Curve Bootstrapping from Coupon Bond Data Given Price.
-
PortVaRreturns.m
-
ProcessInst.m
-
ProcessInstBDT.m
-
spotcurvefit.m
-
DataFeed/Database Portfolio O...
-
View all files
from
Financial Seminar Demos
by Michael Weidman
Demos commonly used at The MathWorks financial modeling seminars.
|
| PortVaRreturns.m |
% calculate portfolio VaR
[fname, pname] = uigetfile('*.xls','Select a file with equity data');
if fname==0
return
end
fname= [pname, fname];
range='a1:j789';
% get equity data
edat = excelget(fname, 1, range);
eprice = cell2mat(edat(2:end, 2:end)); % price data
eret = log(eprice(2:end,:)./eprice(1:end-1,:));
% positions in number of shares
positions = round(1000*rand(1,9));
% positions in monetary value
posvalues = positions.*eprice(end,:);
% confidence level
alpha = norminv(0.95,0,1);
% volatility = sqrt(positions * cov_mat * positions')
sigma = sqrt(posvalues*cov(eret)*posvalues');
% var = conf_level * volatility (daily var)
var = alpha * sigma
|
|
Contact us at files@mathworks.com