Getting Started with Portfolio Optimization
Get a Free Trial: https://goo.gl/C2Y9A5
Get Pricing Info: https://goo.gl/kDvGHt
Ready to Buy: https://goo.gl/vsIeA5
Create and optimize portfolios of assets using the portfolio object in Financial Toolbox, together with Datafeed Toolbox. For more videos, visit http://www.mathworks.com/products/fin...
Closed Caption:
this video will show you how to use the
portfolio object to formulate and solve
a range of asset allocation problems
we will start by demonstrating the east
of fetching data using the data free
tool box then we'll move on to
formulating constraints like equality's
inequalities growth acid bounds budget
and transaction costs at regular
intervals people applaud the efficient
frontier and finish this video with a
summary of the end results
one of the easiest way to import data is
by typing df2 in the command line this
research into opening of the data feed
we select yahoo from the data source and
click on it a new connection will be
made here and you're ready to fetch data
click on the data tab in the enter
security name by the security particular
whose data you want to fish named the
matlab variable click on history and put
the start date and end dates in this
case only fetching data from first june
2001 21st me 2011 on a monthly
periodicity for interested close you can
review the data in this column repeat
the process to add another video
this process can be automated using a
for loop at the command line in the
interest of time I have created am fine
which contains the commands needed to
achieve this bypassing security names in
particular you can it receive the data
so in this case I'm passing the security
because of PGI 832 this variable cotton
picker the syntax is the connection name
security card security field start date
end date and the periodicity of theta M
stands for monthly double strands of
weekly d stands for daily and so on so
you see that some new videos have been
created here with clothes price being a
variable of choice at this stage you
have any of prices it is possible to
convert a cities of prices into
corresponding returns using the price to
return function it is easy to visualize
the data using the plot command the plot
command allows you to add labels to the
excess legends and Titus two graphs in
addition to doing many other things so
in this class we have plotted the
returns of clea Mandela on a monthly
basis
it is time to formulate and solve a
typical asset allocation problem in
matlab the first step in solving these
problems is to create a portfolio object
the portfolio object will accept a range
of constraints and we'll find an optimum
solution amongst a close to put for your
set
let's name our object as djia 30 and
name its individual assets as it occurs
comprising the dow jones industrial
average the portfolio object will have
some properties and methods in this case
we are setting the name property to giat
and using the set aside list method we
are passing the name of the security
because so as you'll note heal the
portfolio has been created it has a name
of PGI 830 the number of assets is 30
and the asset list is contained in a
Cell all the other elements are blank at
this point of time the portfolio object
needs only closed portfolio set to
compute the efficient frontier the most
common problem we'll have an array of
asset returns risks that is the
covariance matrix and common constraints
like no short sales are acids something
to unity expected returns and expected
covariances can be set using the
estimated acid moments method which
accepts that returns we have calculated
in the previous section the default
constraints of no short sales and
portfolio wait something to one can be
set by the set default constraints
method after doing this again brought
the efficient frontier and individual
portfolios using the platform deal and
estimated frontier commands so in this
example the efficient frontier has
implanted in science and the red circles
represent then equidistant portfolios on
this frontier
in reality portfolio location depends on
the needs of investor as defined in the
investor policy statement or IPs let us
consider an IPS then the investor wants
to impose additional constraints on acid
groups for example she may require that
conglomerates should some to exactly ten
percent of the portfolio in our case 3m
that is acid number one GE which is acid
number 13 and utx which is a 727 our
compliments with some should equal . one
in the portfolio will begin by
formulating the concern matrix a which
will be 30 elements long but only the
first 13 and 27 element being set to one
and all others being set to see oh so
you make a matrix a with zeros and set
the first 1327 element is 1 this is an
element of leader equality constraint
which can be hundred and following two
methods
the first is that you use the set
equality method and pass the constraint
matrix a and B into it or you can change
the portfolio properties a quality and
be quality to the respective values
after doing this
let's put the frontier again so you'll
see that a new portfolio has been
plotted in yellow and which has shifted
down because the constraints a bind
think inequality constraints can be
handled in the same thing
it may happen that the investor may be
uncomfortable about winning banking
stocks after the recent financial crisis
and she may want to limit these stocks
at most five percent of the portfolio in
our case Bank of America is number five
and JPMorgan which is exit number 18 our
banks whose sum should be less than 0.05
in the portfolio will again make a
constraint matrix C of touches to the
elements long and said element number
five and 18 corresponding to bank of
america and JPMorgan s1 and using a set
inequality method or by changing the
properties a inequality
b inequality implement these constraints
the new portfolio has been drawn in
black which almost overlaps the
erstwhile yellow portfolio indicating
that the new constraint is loose
it is not necessary that we talked only
in terms of inequalities and
inequalities often you want to specify a
range of acceptable rates for a group of
stocks rather than a strict equality or
inequality we can use the group
constraint method to incorporate his
views suppose we want to limit the food
veg related companies to constitute at
least ten percent and most fifty percent
of our portfolio development companies
in this case of coca-cola kraft foods
and McDonald's will again proceed with
the same thing first single constraint
matrix but only asset numbers 10 20 and
21 being set to 1 and then using either
set groups met heard very past the lower
and upper bound on the group are by
changing the properties group matrix
local group and upper group we implement
this constraint the new frontier in
Green has them back of adding the group
constraint which we see is binding
because the portfolio has shifted
further down there often bones on how
much of a single asset one can hold so
as to not concentrate the portfolio
either in long or short terms let this
particular investor define the long
limit to ten percent the short limit to
five percent so this means that the
weight of an individual asset cannot
exceed ten percent of the portfolio and
cannot fall below minus 0.05 minus five
percent note that this portfolio does
not put a limit on the aggregate short
position after obtaining the desserts
it's always good to check whether we are
still in the regulatory limits we can
implement these constraints by using the
SEC mounts method by changing the lower
bound and upper bound properties so the
new frontiers actually shifted up
because we have removed the no short
sales constraint by allowing individual
assets to go as low as minus five
percent as a reminder you can always
click on the portfolio object to check
its properties so in right now after
imposing all these constraints we see
that we have acid me and asset obedience
the name of the portfolio's DJ partied
has tortilla
sets then the Equality constraints have
been said the quality concerns have been
said lower bound upper bound and local
group and the group matrixes have been
set as well so many investors like to
put limits on the amount they would like
to invest in the riskless asset this may
be due to liquidity concerns are often a
business requirement as in case of a
mutual fund these constraints can be
handled using the budget constraints
method will be implementing a strategy
which will allow us to hold at least
ninety-five percent and at most hundred
and five percent and risky assets a
hundred and five percent allocation
would mean that we can bottle 5% actress
create two by five percent more risky
assets this constraint can be
implemented using the set budget method
when you put in the lower bound and
upper bound of the budget or by changing
the lower budget and the budget
properties
let's take a look at the efficient
frontier now at this one
the efficient frontier is shifted
further up and this magenta line makes
use of the Edit flexibility of boring at
risk late
in practice there are always some
transaction costs the maclab put fully
object allows us to incorporate these
easy using the set costs method get this
is you into buying costs . 5% very
selling costs . 7% the initial portfolio
is distributed 1% and risk-free asset
and the rest in equally weighted risky
assets so their key assets and each of
them has papers including the portfolio
we first set that is created by changing
that is created property to one percent
and then implement the buying costs and
selling costs using the set costs
manhood and initiate would fill you in
the set in it would fully method so in
this last case we see the final blood
and dark blue line which has shifted
considerably down because of the exhibit
in transaction costs keep in mind that
we reduced monthly dance and even a
transaction costs of mine five percent
and runs seven percent has had a
significant effect on to put for you
the lousy had been dealing only with a
portfolio and efficient portfolio class
but what are the amounts that we need to
buy and sell to create these portfolios
this question can be answered by running
the estimated frontier method so in this
case we are going to fight for
equidistant portfolios the corresponding
variables B by B cell and being double
GTS portfolio . have been created
double-click on any one of them so these
amounts that you need to buy from each
of the asset class so that turkey
elements to create what for your number
one the amount that you need to buy to
create for you to put for your clean and
put for your floor
similarly these amounts that you need to
sell from each of the asset time to
create the 40 Christine portfolios and
these are the final weight of the assets
in each other portfolio so if you see
none of the essence here exceeds minus
0.05 are goes about 0.10 was a
constraint steady set for this
it is it bound method
lastly let's allies impact of
transaction costs of running the small
piece of code so as you can realize the
seashell portfolio return remains the
same at- 2.17 percent beat Ross Barnett
neck means after transaction cost growth
means before transaction costs the
minimum efficient portfolio return and
one end of the frontier is my is minus 5
29 and which drops even more down to
minus 15 for 91 person with transaction
costs
similarly the maximum efficient
portfolio return drops from five four
ninety percent to minus 2.2 and visit
please visit the financial tool box page
and at www.mataharicourse.com thank you
Video Length: 13:36
Uploaded By: MATLAB
View Count: 13,224