setCosts

Set up proportional transaction costs

Description

example

obj = setCosts(obj,BuyCost) sets up proportional transaction costs for Portfolio, PortfolioCVaR, or PortfolioMAD objects. For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

example

obj = setCosts(obj,BuyCost,SellCost,InitPort,NumAssets) sets up proportional transaction costs for portfolio objects 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}

Examples

collapse all

Given a Portfolio object p with an initial portfolio already set, use the setCosts function 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);
5
0.0013
0.0013
0.0013
0.0013
0.0013
disp(p.SellCost);
0.0013
0.0070
0.0013
0.0013
0.0024
disp(p.InitPort);
0.4000
0.2000
0.2000
0.1000
0.1000

Given a CVaR portfolio object p with an initial portfolio already set, use the setCosts function 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 = PortfolioCVaR('InitPort', x0);
p = setCosts(p, bc, sc);

disp(p.NumAssets);
5
0.0013
0.0013
0.0013
0.0013
0.0013
disp(p.SellCost);
0.0013
0.0070
0.0013
0.0013
0.0024
disp(p.InitPort);
0.4000
0.2000
0.2000
0.1000
0.1000

Given PortfolioMAD object p with an initial portfolio already set, use the setCosts function 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 = setCosts(p, bc, sc);

disp(p.NumAssets);
5
0.0013
0.0013
0.0013
0.0013
0.0013
disp(p.SellCost);
0.0013
0.0070
0.0013
0.0013
0.0024
disp(p.InitPort);
0.4000
0.2000
0.2000
0.1000
0.1000

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Data Types: object

Proportional transaction cost to purchase each asset, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

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.

Data Types: double

Proportional transaction cost to sell each asset, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

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.

Data Types: double

Initial or current portfolio weights, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

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

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

Data Types: double

Number of assets in portfolio, specified as a scalar for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

NumAssets cannot be used to change the dimension of a portfolio object.

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

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

• You can also 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.

Introduced in R2011a