simulate_history: Calculate the returns in history given a set of static...

simulate_historyR Documentation

Calculate the returns in history given a set of static strategy weights

Description

Calculate the returns in history given a set of static strategy weights

Usage

simulate_history(unwt_ret, curr_wt, start_date, end_date)

Arguments

unwt_ret

A dataframe containing the timeseries unweighted return of strategies, with columns 'date', 'strategy', 'return'

curr_wt

A dataframe weights of strategies with columns 'strategy', 'size'

start_date

A Date variable indicating the start period of simulation

end_date

A Date variable indicating the end period of simulation

Value

A dataframe containing the timeseries weighted return of the period

Examples

portfolios <- build_strategies(demo_strategies, as.Date("2016-01-01"), as.Date("2018-12-07"))
sim_pf_size <- convert_dur_size(portfolios$sim, portfolios$summary, demo_duration)
wt_return <- calc_strat_wt_return(sim_pf_size, demo_return)
headline_size <- calc_strat_headline_size(sim_pf_size)
unwt_return <- calc_strat_unwt_return(wt_return, headline_size)
curr_wt <- get_strat_size(headline_size, as.Date("2018-01-05"))
simulate_history(unwt_return, curr_wt, as.Date("2016-01-01"), as.Date("2018-01-01"))

yunching/tidymas documentation built on Feb. 5, 2023, 1:42 p.m.