Description Value Methods Author(s)
Manage your portfolio never be so easy. This object will save all your portfolio and help you manage them all at once. You can do backtesting by combining this object with powerful tools such as TTR package to generate a technical analysis.
Object of type portfolio
add_portfolio()
Add portfolio that you have into the object. Each portfolio will be stored using prefix portfolio.
portfolio$add_portfolio(data, symbol = deparse(substitute(data)))
data:
The portfolio that you add
symbol:
The name of the portfolio you were added
Object of type portfolio
add_col()
Add colum to your portfolio data. In some cases, you have your own custom column. In that case, you can add some by using this method.
portfolio$add_col(x, colname, symbols = NULL)
x:
vector for the data
symbol:
The name of the portfolio you want to add to. Please be aware, if you set this leave as NULL, it may not work as expected. It is because it will add the column to all portfolio that may have different dimension.
Object of type portfolio
add_indicator()
Instead of adding a column, you might want to add an indicator to your portfolio. Using this method you can directly calculate the indicator and add the data to your portfolio.
portfolio$add_indicator( .fun, colnames, indicator_name = deparse(substitute(.fun)), to_vector = FALSE, ... )
.fun:
the function to calculate the desired indicator
colnames:
The name of the column to store the new indikator. If left blank, it will take the name of the function.
to_vector:
To indicate you want to drop the dataframe using drop = TRUE
argument.
...:
This ellipsis used to store the arguments needed by the function. Refers to each function to use it.
Object of type portfolio
remove_na()
In trading data, the famous indicators are EMA, SMA or so on that in fact need to lag data. The backwards is that it leaves so many NAs. Call this method to clean the messy.
portfolio$remove_na()
Object of type portfolio
clone()
The objects of this class are cloneable with this method.
portfolio$clone(deep = FALSE)
deep
Whether to make a deep clone.
Suberlin Sinaga @2021
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.