Main Content

setCosts

Set up proportional transaction costs for portfolio

Description

example

obj= setCosts(obj,BuyCost)sets up proportional transaction costs forPortfolio,PortfolioCVaR, orPortfolioMADobjects. For details on the respective workflows when using these different objects, seePortfolio Object Workflow,PortfolioCVaR Object Workflow, andPortfolioMAD Object Workflow.

example

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

Given proportional transaction costs and an initial portfolio in the variablesBuyCost,SellCost, andInitPort, the transaction costs for any portfolioPortreduce expected portfolio return by:

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

Examples

collapse all

Given a Portfolio objectpwith an initial portfolio already set, use thesetCostsfunction 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
disp(p.BuyCost);
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 objectpwith an initial portfolio already set, use thesetCostsfunction 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
disp(p.BuyCost);
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 objectpwith an initial portfolio already set, use thesetCostsfunction 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 = PortfolioMAD('InitPort', x0); p = setCosts(p, bc, sc); disp(p.NumAssets);
5
disp(p.BuyCost);
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 usingPortfolio,PortfolioCVaR, orPortfolioMADobject. For more information on creating a portfolio object, see

Data Types:object

Proportional transaction cost to purchase each asset, specified as a vector for aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Note

  • IfBuyCost,SellCost, orInitPortare specified as scalars andNumAssetsexists or can be imputed, then these values undergo scalar expansion. The default value forNumAssetsis1.

  • Transaction costs inBuyCostandSellCostare 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 aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Note

  • IfBuyCost,SellCost, orInitPortare specified as scalars andNumAssetsexists or can be imputed, then these values undergo scalar expansion. The default value forNumAssetsis1.

  • Transaction costs inBuyCostandSellCostare 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 aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Note

If noInitPortis specified, that value is assumed to be0.

  • IfBuyCost,SellCost, orInitPortare specified as scalars andNumAssetsexists or can be imputed, then these values undergo scalar expansion. The default value forNumAssetsis1.

  • Transaction costs inBuyCostandSellCostare 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 aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Note

NumAssetscannot be used to change the dimension of a portfolio object.

  • IfBuyCost,SellCost, orInitPortare specified as scalars andNumAssetsexists or can be imputed, then these values undergo scalar expansion. The default value forNumAssetsis1.

  • Transaction costs inBuyCostandSellCostare 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 aPortfolio,PortfolioCVaR, orPortfolioMADobject. 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);

  • IfBuyCostorSellCostare input as empties with[], the corresponding attributes in the portfolio object are cleared and set to[]. IfInitPortis set to empty with[], it will only be cleared and set to[]ifBuyCost,SellCost, andTurnoverare also empty. Otherwise, it is an error.

Version History

Introduced in R2011a