calc_strat_wt_return: Calculate weighted return of strategies

Description Usage Arguments Value Examples

Description

Calculate weighted return of strategies

Usage

1
calc_strat_wt_return(strat_df, asset_returns)

Arguments

strat_df

A dataframes for each strategy with their corresponding timeseries sizes in percent or month-weighted sizes. Columns should be 'date', 'strategy', 'instrument', 'size'

asset_returns

A dataframe with time-series returns of all instruments with column name as the 'identifier'

Value

A dataframe containing the time-series daily return of all instruments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
portfolios <- build_strategies(demo_strategies, as.Date("2016-01-01"), as.Date("2018-12-07"))
dur <- demo_duration
actual_pf_size <- convert_dur_size(portfolios$actual, portfolios$summary, dur)
ret <- demo_return
calc_strat_wt_return(actual_pf_size, ret)

# With Bloomberg
portfolios <- build_strategies(demo_strategies)
dur <- get_dur_bbg(portfolios$summary)
actual_pf_size <- convert_dur_size(portfolios$actual, portfolios$summary, dur)
ret <- get_ret_bbg(portfolios$summary)
calc_strat_wt_return(actual_pf_size, ret)

yunching/tidymas documentation built on Feb. 17, 2020, 5:13 a.m.