construct_rebalance_infrastructure: Build a Rebalance Infrastrucure

View source: R/construct_rebalance_infrastructure.R

construct_rebalance_infrastructureR Documentation

Build a Rebalance Infrastrucure

Description

Prepares a snoop_rolling object before passing it through rebalance_portfolio.

Usage

construct_rebalance_infrastructure(
  .data,
  .by = c("day", "week", "month", "year")
)

Arguments

.data

A tabular (non-tidy) tibble.

.by

A string with the periodicity to compute the rebalance. One of: day, week, month or year.

Value

A tibble of the snoop_rebalance class. Contains 3 columns: .date, .analysis and .assessment.

Examples

stocks <- tibble::tibble(
  time = as.Date('2009-01-01') + 0:99,
  X    = rnorm(100, 0, 1),
  Y    = rnorm(100, 0, 2),
  Z    = rnorm(100, 0, 4)
)

roll <- construct_rolling_infrastructure(stocks, .initial = 50)

const <- construct_rebalance_infrastructure(roll)
const

# Contains information under the hood:
class(const)

Reckziegel/snoop documentation built on July 1, 2022, 5:32 a.m.