Documentation Center

  • Trial Software
  • Product Updates

setCosts

Class: Portfolio

Set up proportional transaction costs

Syntax

obj = setCosts(obj,BuyCost)
obj = setCosts(obj,BuyCost,SellCost,InitPort,NumAssets)

Description

obj = setCosts(obj,BuyCost) sets up proportional transaction costs to purchase assets.

obj = setCosts(obj,BuyCost,SellCost,InitPort,NumAssets) sets up proportional transaction costs with additional options specified for SellCost, InitPort, and NumAssets.

Given proportional transaction costs and an initial portfolio in the variables BuyCost, SellCost, and InitPort, the transaction costs for any portfolio Port reduce expected portfolio return by:

BuyCost' * max{0, Port - InitPort} + SellCost' * max{0, InitPort - Port}

Tips

  • Use dot notation to set up proportional transaction costs.

    obj = obj.setCosts(BuyCost, SellCost, InitPort, NumAssets);
    
  • If BuyCost or SellCost are input as empties with [], the corresponding attributes in the Portfolio object are cleared and set to []. If InitPort is set to empty with [], it will only be cleared and set to [] if BuyCost, SellCost, and Turnover are also empty. Otherwise, it is an error.

Input Arguments

obj

Portfolio object [Portfolio].

BuyCost

Proportional transaction cost to purchase each asset [vector].

SellCost

Proportional transaction cost to sell each asset [vector].

InitPort

Initial or current portfolio weights [vector].

    Note:   If no InitPort is specified, that value is assumed to be 0.

NumAssets

Number of assets in portfolio [scalar]. NumAssets cannot be used to change the dimension of a Portfolio object.

    Note:   If BuyCost, SellCost, or InitPort are specified as scalars and NumAssets exists or can be imputed, then these values undergo scalar expansion. The default value for NumAssets is 1.

    Transaction costs in BuyCost and SellCost are positive valued if they introduce a cost to trade. In some cases, they can be negative valued, which implies trade credits.

Output Arguments

obj

Updated Portfolio object [Portfolio].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Set Up Transaction Costs

Assume 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 the setCosts method 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 = p.setCosts(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

See Also

|

Was this topic helpful?