View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Financial Seminar Demos

4.0 | 12 ratings Rate this file 19 Downloads (last 30 days) File Size: 1020 KB File ID: #4564 Version:

Financial Seminar Demos


Ameya Deoras (view profile)


02 Mar 2004 (Updated )

Demos commonly used at The MathWorks financial modeling seminars.

| Watch this File

File Information

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.
Creates an array in MATLAB and shows indexing ability and examples of matrix math

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

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

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

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

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

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

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

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

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

Required Products Database Toolbox
Datafeed Toolbox
Financial Derivatives Toolbox
Financial Toolbox
Fixed-Income Toolbox
GARCH Toolbox
MATLAB Compiler
Optimization Toolbox
Spreadsheet Link
Statistics and Machine Learning 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 (18)
10 Dec 2016 andrea miniagio

edit: my fault

Comment only
10 Dec 2016 andrea miniagio

no work monte carlo

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

Grace (view profile)

great,great resource

Comment only
22 Nov 2010 ?

? (view profile)

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:
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..

Comment only
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

Comment only
27 Oct 2006 Trung Nguyen


Comment only
28 Jul 2006 antonis dendis

11 May 2006 Roy Chiu

06 Apr 2006 yuanxin ma

convenient use and fast speed

Comment only
07 Oct 2005 Dimitri Shvorob

Thank you, Brian.

17 Apr 2004 Kuntamukkala Ravi

09 Nov 2010 1.1

Updated Introduction file and added a BSD license.

12 Nov 2010 1.2

Updates to the ReadMe files

01 Sep 2016

Updated license

Contact us