4.3 | 11 ratings Rate this file 57 Downloads (last 30 days) File Size: 523 KB File ID: #29807
image thumbnail

Portfolio Optimizer Tool


Patric Schenk (view profile)


22 Dec 2010 (Updated )

Portfolio Optimizer Tool

| Watch this File

File Information

Files used in the Webinar: Build a Portfolio Analysis Production Application in MATLAB using Object-Oriented Programming Techniques.

The focus of this demo is to introduce the design and development of a complete MATLAB application from concept through to completion. The GUI-based tool provides functionalities to import price series from various data sources; and to define complex optimization constraints on the data. Furthermore, the tool provides extensive interactive visualization capabilities for the optimization results and key risk metrics. Finally, all relevant information is reported to Excel and PDF based documentation in a compact manner.

The focus of the demo is application development:
- Data Import
- GUI-Building/implementation of interactive graphical components
- Optimization/Risk metrics
- Object-oriented programming
- Report to Excel
- Standalone components


This file inspired Matlab For R Users In Computational Finance.

Required Products Datafeed Toolbox
Financial Toolbox
Optimization Toolbox
Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (22)
12 Jan 2015 polar

polar (view profile)

Hi, I'm testing "portfoliotool.m" on Matlab 2010b version.
My problem is with Yahoo downloading. By surfing the codes it refers to Internetexplorer.application but I'm using chrome. How can I fix it?

Comment only
21 Nov 2014 Juno

Juno (view profile)

Great Package!

17 Nov 2013 David Gerhard D

Great Try. Well Thought, but there are problems for 2013b, because the output/ report and excel creating part is not complete or compatible.
I had to download data from yahoo finance manually to a excel file and imported it.

12 Jun 2013 srinivas mudavath

It will be very useful from your help.

I have downloaded the code for the
webinar "Build a Portfolio Analysis Production Application in MATLAB using Object-Oriented Programming Techniques".
i am running this code on "Matlab 2010a"

when i run portfoliotool.m, a "Portfolio Optimization Tool" GUI pops up.
in Dataimport panel,

if I select "Yahoo! finance Datafeed" in datasource and choose any of indexes that are listed in "Choose index" and when I press "download symbols" i get error saying
"No appropriate method, property, or field getElementsByTagNames for class Interface.JScriptTypeinfo_JScript_Type_Info."

if I select "Excel" and browse the file you have given "DAX.xlsx" and enter Sheet name(Sheet 1), Date Header name(Dates), Date format(mm/dd/yyyy) and when i press "Import Data" i get error saying
"Note: No date header with name "Dates" found".

I searched on these errors on google, i didn't found solutions and i tried to figure out through "callback function" then also i didn't get the solutions to the problem.
I even tried by downloading the code twice and checked whether i have made any changes in code, still i didn't find solution.

it will be a great help from your side.
thanks in advance...

Comment only
15 Oct 2012 Andres Licona

I think it is a good tool as you can see what you can do with a gui as well. The Yahoo download option is not working.
I do like is the flexibility of this tool.

Comment only
18 Jul 2012 Tim Maguire

Great package.

Which optimization approach are you using. Is this a general mean variance optimization or a specific derivative.

13 Jul 2012 Carlos Freyre

Figured out the earlier problem re downloading the symbols, but how do you change the available symbol indices dropdown to include DJIA, NYSE, NASDAQ, etc?

Comment only
13 Jul 2012 Carlos Freyre

Looking for some a little help...I'm trying to run portfoliotool.m but can not get past downloading the symbols.
For example: I select the ^GDAX, click download button and get an error message: "no appropriate method, property or field" any help is much appreciated. Thx.

Comment only
16 Mar 2012 Steven

Steven (view profile)

I've now managed to open the tool but when I try to import data from excel I get the following error. Can someone help me please? Is it important how the dates are defined in Excel?

Error using datestr (line 179)
Cannot convert input into specified date string.
DATENUM failed.

Error in portfoliotool>updateImportDataPage (line 2095)
datesstr = cellstr(datestr(dates,handles.datestringformat));

Error in portfoliotool>button_dataimport_excelfile_import_Callback (line 2293)

Error in gui_mainfcn (line 96)

Error in portfoliotool (line 25)
gui_mainfcn(gui_State, varargin{:});

Error in

Error while evaluating uicontrol Callback


Comment only
16 Mar 2012 Steven

Steven (view profile)

I'm still unable to open the portfoliotool.m
What is the exact code to do this? And where should the file be saved?
I don't have the optimization toolbox. Is that a problem?

Comment only
22 Feb 2012 Mathijs Faase

Hi Gregoire,

The portfoliotool.fig is just the description of the different components of the GUI - to actually launch it, you should use the potfolio.m file.

Without the datafeed toolbox you will still be able to use most of the tool - you will not be able to import live data, though.

Comment only
02 Feb 2012 Grégoire

When I load the code, and launch the portfoliotool.fig, it looks like the three pages are on the same layer and the figure is unreadable.
Anyone know how to solve this?
ps: don't have the datafeed toolbox

Comment only
13 Jan 2012 Karamos

Great Work!

29 Dec 2011 Patric Schenk

Patric Schenk (view profile)

@Hugh: Make sure to change the current folder in MATLAB and type "portfoliotool" in the command window to run the tool.

Comment only
28 Dec 2011 Hugh

Hugh (view profile)

This looks interesting. I am sorry, how do I run this file?

Comment only
23 Dec 2011 ??

?? (view profile)

09 Nov 2011 Salman

Salman (view profile)

Well as for the the problem related to downloading from yahoo is concerned, it can be resolved in this way..

open the file portfoliotool.m. find

tables = h.document.getElementsByTagName('table');

and replace it with

tables = h.Document.documentElement.getElementsByTagName('table');

31 May 2011 Kate

Kate (view profile)

29 Mar 2011 Andrew Li

I encountered several errors when running the programs, and really have no idea how to solve it
wish you anyone could help me. Thanx!

??? Error using ==> maxdrawdown
Too many input arguments.

Error in ==> Portfolio>Portfolio.getPerformanceMetrics at 251
metrics.maxdrawdown = maxdrawdown(pf_returns,'arithmetic');

Error in ==> portfoliotool>edit_results_riskfreerate_Callback at 1406
metrics = handles.model.getPerformanceMetrics(selection, riskfreerate/100);

Error in ==> portfoliotool>updateResultsPage/portfolioselection_callback at 695
edit_results_riskfreerate_Callback(handles.edit_results_riskfreerate, [], handles);

??? Error while evaluating line ButtonDownFcn

16 Mar 2011 Robbie Castelijn

I noticed that since a few weeks the Yahoo feed isn't working for indices like DAX , AEX etc.

26 Dec 2010 Andres Licona

I work in trading this code. I always use this type of tool and man It rocks to be a quant!!!!

24 Dec 2010 sadel

sadel (view profile)

when I am trying to run portfoliotool.fig:

Unhandled internal error in guidefunction
Error using==> feval

03 Jan 2011

comment change

Contact us