convert_dur_size: Converts size in months to size in percent of portfolio terms

convert_dur_sizeR Documentation

Converts size in months to size in percent of portfolio terms

Description

Converts size in months to size in percent of portfolio terms

Usage

convert_dur_size(strat_df, strat_id_sizetype, duration_df,
  convert_to_decimal = TRUE)

Arguments

strat_df

A gathered dataframe containing 'date', 'strategy', 'instrument', and 'size' in percent or month-weighted sizes.

strat_id_sizetype

A dataframe containing the columns of 'strategy', 'identifier' and 'size_type' that correspondings to those in strat_df. 'size_type' must be 'months' or 'percent'

duration_df

A dataframe containing timeseries duration of assets, can be generated from 'get_dur_bbg'

convert_to_decimal

A boolean indicating if all final percent numbers be converted to decimal form ie. divide by 100

Value

A dataframes with same structure as 'strat_df', but sizes converted to percent form

Examples

data(demo_strategies)
data(demo_duration)
portfolios <- build_strategies(demo_strategies, as.Date("2016-01-01"), as.Date("2018-12-07"))
actual_pf_size <- convert_dur_size(portfolios$actual, portfolios$summary, demo_duration)

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