Description Usage Arguments Details
Function to replace asset returns for non-index members with zero. Used to simulate moving to cash for returns-based simulations.
1 | member_exit(df, hist_members = newHM)
|
hist_members |
xts object containing membership data. Column names are assumed to be asset names corresponding to those in df. Note: All entries not NA are assumed to represent active membership. #' @param df xts object containing price series of assets to rank. Every column will be treated as an independent asset. Column names of assets to rank must also appear in column names of 'hist_members' |
For the blotter simulation we exit any position for which the asset loses index membership and put that money in cash. For the returns-based simulation we can not do this explicitly without rebalancing all positions, which we do not want to do. However, we can simulate going to cash for that asset only, by assumming it generates zero return while it is not a member. That way, if we are holding the asset and it loses membership, it is as if we went to cash. The function will also replace missing returns (NAs) with zero.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.