Code covered by the BSD License  

Highlights from
Financial Seminar Demos

4.09091

4.1 | 11 ratings Rate this file 23 Downloads (last 30 days) File Size: 1020 KB File ID: #4564

Financial Seminar Demos

by

 

02 Mar 2004 (Updated )

Demos commonly used at The MathWorks financial modeling seminars.

| Watch this File

File Information
Description

Ten demos, most of which are shown at The MathWork's financial modeling seminars. All of the demos are in their own folders, which contain the code, and a ReadMe file that explains what the demos do and gives directions on how to run it. The ReadMe also mentions which Toolboxes are needed for each demo. To run all of the demos, you'll need the Toolboxes listed in the required list. However, not all of the demos require all of the Toolboxes.

MLTutorial:
Creates an array in MATLAB and shows indexing ability and examples of matrix math

DFDBportOpt:
GUI that inputs data from database or Yahoo(Datafeed) and finds the efficient frontier

BLSVIS:
Plots a 3d visualization of option sensitivities ? Delta and Gamma

GarchFXdemo:
GARCH demo showing time-series, simulation, optimization, and graphics abilities of MATLAB.

OpriceAnimation:
Animates option prices, gamma, and volatility in 3D as time to maturity changes

Xlderiv:
Illustrates how to price an fixed-income instrument portfolio using the Heath-Jarrow-Morton and Black-Derman-Toy interest rate models

SpotCurveFit:
Computes and compares spot and forward curves calculated from bootstrapping and spline fitting methods

OptVar:
Calculates the Value at Risk (VaR) of a portfolio of equity options using the delta-gamma

method.PortVaRmc:
Calculates the Value at Risk (VaR) of a portfolio of equities using Monte Carlo simulation

PortVaRreturns:
Calculates the Value at Risk (VaR) of a portfolio of equities using historical return data

Required Products Database Toolbox
Datafeed Toolbox
Spreadsheet Link EX
Financial Derivatives Toolbox
Financial Toolbox
Fixed-Income Toolbox
GARCH Toolbox
MATLAB Compiler
Optimization Toolbox
Statistics Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (16)
26 Jun 2013 Pourya Alinezhad  
03 Apr 2012 Allison Zhou

Great sample files. I think there is an error in the Monte Carlo simulation though. If my understanding is correct, time=0:20 is the number of steps in each simulation. As such, we need to adjust the drifts and std's by it. So in the montecarlo.m file,

drifts = mRet.*dt/(tLen-1);
stds = valat.*sqrt(dt/(tLen-1));

Otherwise we are not projecting one-day returns.

19 Dec 2010 Grace

great,great resource

22 Nov 2010 ?

Thank you very much!

07 Sep 2010 Giorgio Solfaroli

Thank you very much!
I just have one question:
on the PortVarmc.m file the time vector is set like this by default:
time=0:20;
exactly, what does it means?

I have a 74 daily observation time series, how do i have to change it?

Sorry to seem dumb but i'm just new to MatLab.

Thanks in advance for your attention.

17 Aug 2007 Marcelo Perlin

I forgot to take the square..

The right equation is:

Port_std=sqrt( E[x_t - E(x_t)]^2 )

Simplifying this formula will show the covariance part..

16 Aug 2007 Marcelo Perlin

faezeh raei is right.

At line 86 of PortVarMC.m the standard deviation is not taking into account the existence of correlation between the assets.

If you're simulating uncorrelated assets, then no problem, but since you used Cholesky factorization for the creation of random correlated returns, then the equation doesn't hold.

The right equation is:

Port_std=E[x_t - E(x_t)]^2

where x_t is the portfolio return in time t (calculated using the weights) and E() is the expectation operator.

Since you're dealing with 9 assets, the equation is very big so i'm not going to post it here. A better way of calculating the std would be to build the portfolio return trough time and then just take the std of such vector.

Also, I don't get it for you to be using uigetfile() when you have next the line range='a1:j789' , meaning that the algorithm will only work properly for that particular file at the example (equity.xls).

Why not change the function for a excel file of any range ??

28 Jun 2007 faezeh raei

I think there is an error in PortVaRmc.m
At the end, for computation of VAR, standard deviation of whole portfolio is considered to be weighted sum of std of return of its constituent assets. However the constituent assets are correlated and their covariances should be included in std of portfolio as well.

13 Jun 2007 Sophia Zhao  
12 May 2007 gregorio vargas

esto es una maravilla

27 Oct 2006 Trung Nguyen

user

28 Jul 2006 antonis dendis  
11 May 2006 Roy Chiu  
06 Apr 2006 yuanxin ma

convenient use and fast speed

07 Oct 2005 Dimitri Shvorob

Thank you, Brian.

17 Apr 2004 Kuntamukkala Ravi  
Updates
09 Nov 2010

Updated Introduction file and added a BSD license.

12 Nov 2010

Updates to the ReadMe files

Contact us