working with transaction costs
the difference between net and gross portfolio returns is transaction costs. the net
portfolio return proxy has distinct proportional costs to purchase and to sell assets
which are maintained in the portfolio
object properties
buycost
and sellcost
. transaction costs are in
units of total return and, as such, are proportional to the price of an asset so that
they enter the model for net portfolio returns in return form. for example, suppose that
you have a stock currently priced $40 and your usual transaction costs are five cents
per share. then the transaction cost for the stock is 0.05/40 = 0.00125 (as defined in
). costs are entered as positive values and credits
are entered as negative values.
setting transaction costs using the portfolio
function
to set up transaction costs, you must specify an initial or current portfolio in
the initport
property. if the initial portfolio is not set when
you set up the transaction cost properties, initport
is
0
. the properties for transaction costs can be set using
the object. for example, assume
that purchase and sale transaction costs are in the variables bc
and sc
and an initial portfolio is in the variable
x0
, then transaction costs are
set:
bc = [ 0.00125; 0.00125; 0.00125; 0.00125; 0.00125 ]; sc = [ 0.00125; 0.007; 0.00125; 0.00125; 0.0024 ]; x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ]; p = portfolio('buycost', bc, 'sellcost', sc, 'initport', x0); disp(p.numassets) disp(p.buycost) disp(p.sellcost) disp(p.initport)
5 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0070 0.0013 0.0013 0.0024 0.4000 0.2000 0.2000 0.1000 0.1000
setting transaction costs using the setcosts
function
you can also set the properties for transaction costs using . assume that you have the
same costs and initial portfolio as in the previous example. given a
portfolio
object p
with an initial
portfolio already set, use to set up transaction
costs:
bc = [ 0.00125; 0.00125; 0.00125; 0.00125; 0.00125 ];
sc = [ 0.00125; 0.007; 0.00125; 0.00125; 0.0024 ];
x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ];
p = portfolio('initport', x0);
p = setcosts(p, bc, sc);
disp(p.numassets)
disp(p.buycost)
disp(p.sellcost)
disp(p.initport)
5 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0070 0.0013 0.0013 0.0024 0.4000 0.2000 0.2000 0.1000 0.1000
you can also set up the initial portfolio's initport
value as
an optional argument to so that the following is
an equivalent way to set up transaction costs:
bc = [ 0.00125; 0.00125; 0.00125; 0.00125; 0.00125 ]; sc = [ 0.00125; 0.007; 0.00125; 0.00125; 0.0024 ]; x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ]; p = portfolio; p = setcosts(p, bc, sc, x0); disp(p.numassets) disp(p.buycost) disp(p.sellcost) disp(p.initport)
5 0.0013 0.0013 0.0013 0.0013 0.0013 0.0013 0.0070 0.0013 0.0013 0.0024 0.4000 0.2000 0.2000 0.1000 0.1000
for an example of setting costs, see .
setting transaction costs with scalar expansion
both the object and the function implement scalar
expansion on the arguments for transaction costs and the initial portfolio. if the
numassets
property is already set in the
portfolio
object, scalar arguments for these properties are
expanded to have the same value across all dimensions. in addition, lets you specify
numassets
as an optional final argument. for example, assume
that you have an initial portfolio x0
and you want to set common
transaction costs on all assets in your universe. you can set these costs in any of
these equivalent
ways:
x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ]; p = portfolio('initport', x0, 'buycost', 0.002, 'sellcost', 0.002);
or
x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ];
p = portfolio('initport', x0);
p = setcosts(p, 0.002, 0.002);
or
x0 = [ 0.4; 0.2; 0.2; 0.1; 0.1 ]; p = portfolio; p = setcosts(p, 0.002, 0.002, x0);
to clear costs from your portfolio
object, use either the
object or with empty inputs for the
properties to be cleared. for example, you can clear sales costs from the
portfolio
object p
in the previous
example:
p = portfolio(p, 'sellcost', []);
see also
| | | |
related examples
- estimate efficient frontiers for portfolio object
- portfolio optimization examples using financial toolbox™