getCosts

Obtain buy and sell transaction costs from portfolio object

Use the getCosts function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to obtain buy and sell transaction costs from portfolio objects.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

[BuyCost,SellCost] = getCosts(obj)

Description

example

[BuyCost,SellCost] = getCosts(obj) obtains buy and sell transaction costs from portfolio objects.

Examples

collapse all

Given portfolio p with the costs set, obtain the values for BuyCost and SellCost.

p = Portfolio;
p = setCosts(p, 0.001, 0.001, 5);
[BuyCost, SellCost] = getCosts(p)
BuyCost = 1.0000e-03
SellCost = 1.0000e-03

Given a PortfolioCVaR object p with the costs set, obtain the values for BuyCost and SellCost.

p = PortfolioCVaR;
p = setCosts(p, 0.001, 0.001, 5);
[BuyCost, SellCost] = getCosts(p)
BuyCost = 1.0000e-03
SellCost = 1.0000e-03

Given a PortfolioMAD object p with the costs set, obtain the values for BuyCost and SellCost.

p = PortfolioMAD;
p = setCosts(p, 0.001, 0.001, 5);
[BuyCost, SellCost] = getCosts(p)
BuyCost = 1.0000e-03
SellCost = 1.0000e-03

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

Output Arguments

collapse all

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

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

Tips

You can also use dot notation to obtain the buy and sell transaction costs from portfolio objects.

[BuyCost, SellCost] = obj.getCosts;

Introduced in R2011a