position_limit_constraint | R Documentation |
This function is called by add.constraint when type="filter" is specified, add.constraint
position_limit_constraint(
type = "position_limit",
filter_name = NULL,
enabled = TRUE,
message = FALSE,
...
)
type |
character type of the constraint |
filter_name |
either a function to apply, or a name of a function to apply |
enabled |
TRUE/FALSE |
message |
TRUE/FALSE. The default is message=FALSE. Display messages if TRUE. |
... |
any other passthru parameters to specify position limit constraints |
Allows the user to specify a filter function which will take returns, weights, and constraints as inputs, and can return a modified weights vector as output.
Fundamentally, it could be used to filter out certain assets, or to ensure that they must be long or short.
Typically, filter functions will be called by the random portfolio simulation function or via the fn_map function.
an object of class 'position_limit_constraint'
Ross Bennett
add.constraint
data(edhec)
ret <- edhec[, 1:4]
pspec <- portfolio.spec(assets=colnames(ret))
pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3)
pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos_long=3, max_pos_short=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.