Description Usage Arguments Details Value

View source: R/riskparity_screen.R

Returns an xts matrix of asset weights, modulated according to a set of rules.

1 2 3 4 | ```
riskparity_screen(prices, maxweights = 0.5, riskpar_feature = "sd252",
riskpar_thresh = 0.12, momfeature = "mom252", LTmomfactor = 0,
absmom_thresh = 0.05, cashasset = 1, Nassets = ncol(prices),
defaultweight = 0.3, return_matrices = FALSE)
``` |

`prices` |
An xts matrix of asset prices. |

`maxweights` |
A vector containing the maximum allowable weight for each asset. The vector is recycled or truncated if too short or too long. Default is 0.5. |

`riskpar_feature` |
The volatility feature that will be computed from the prices matrix using function make_feature. Default is sd252. |

`riskpar_thresh` |
The volatility threshold at which the asset weight will be scaled back, according to the formula min(1, riskparity / asset_volatility), where asset_volatility is the result of the riskpar_feature feature. |

`momfeature` |
The momentum feature used to filter for absolute momentum. |

`absmom_thresh` |
The absolute momentum threshold below which assets are excluded. |

`cashasset` |
The column number or name of the cash asset. This asset has a fixed weight of 1 so the optimizer can always select it, if all other assets have a zero weight. Default is column 1. |

`Nassets` |
The number of assets held in the portfolio at any given time. This is used as a ranking threshold beyond which an asset weight is forced to zero i.e. excluded. For example, if Nassets = 4, then the top 3 highest momentum assets are included at the given date while all other assets are excluded by setting their weights to zero. The cash asset is always included and treated separately. So in the above example, the top 3 assets plus the cash asset are included. |

`return_matrices` |
Logical. If set to TRUE, the momentum and volatility matrices are returned in addition to the xts of asset weights. Default is FALSE. |

The xts matrix returned will generally start at a later time that the prices matrix since features are calculated from it. Therefore, you must ensure that it properly aligns with other matrices in the calling function.

The first rule applied is...

Returns an xts matrix of asset weights. Some weights may be zero if the asset was screened out at the given time index.

If return_matrices is TRUE, then a list of 3 objects is returned. The first object ($max_weights) is the xts matrix of maximum asset weights. The second object ($momentum_mat) is the asset momentum xts matrix. The third object ($volatility_mat) is the volatility xts matrix.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.