A portfolio model specifies the target weights of a portfolio, along with drift tolerances and cooldown periods.

create_portfolio_model(name, description, cash, assets, tolerance, cooldown)

Arguments

name

name of the model

description

description of the model

cash

cash data frame

assets

assets data frame

tolerance

percentage by which and symbols is permitted to drift from target weight

cooldown

number of days after successful rebalance to wait before new rebalance can be triggered

Value

a portfolio model object

Examples

name <- "sample_portfolio"
description <- "create from function"
cash <- list(percent = 10)
assets <- data.frame(symbol = c("AAPL","GOOG"), percent = c(80.5,9.5))
tolerance <- list(percent = 5)
cooldown <- list(days = 365)

create_portfolio_model(name = name,
                       description = description,
                       cash = cash,
                       assets = assets,
                       tolerance = tolerance,
                       cooldown = cooldown)
#> $name
#> [1] "sample_portfolio"
#> 
#> $description
#> [1] "create from function"
#> 
#> $cash
#> $cash$percent
#> [1] 10
#> 
#> 
#> $assets
#>   symbol percent
#> 1   AAPL    80.5
#> 2   GOOG     9.5
#> 
#> $tolerance
#> $tolerance$percent
#> [1] 5
#> 
#> 
#> $cooldown
#> $cooldown$days
#> [1] 365
#> 
#> 
#> $created_at
#> [1] "2024-03-18T19:53:07"
#> 
#> $updated_at
#> [1] "2024-03-18T19:53:07"
#>