align_to_timeframe: Align Data to Strategy Timeframe

View source: R/utils.R

align_to_timeframeR Documentation

Align Data to Strategy Timeframe

Description

Aligns higher-frequency data to match strategy timeframe.

Usage

align_to_timeframe(
  high_freq_data,
  low_freq_dates,
  method = c("forward_fill", "nearest", "interpolate")
)

Arguments

high_freq_data

Data frame to align

low_freq_dates

Date vector from strategy

method

Alignment method: "forward_fill", "nearest", or "interpolate"

Value

Aligned data frame

Examples

data("sample_prices_weekly")
data("sample_prices_daily")
momentum <- calc_momentum(sample_prices_weekly, lookback = 12)
selected <- filter_top_n(momentum, 10)
# Create a stability signal from daily data
daily_vol <- calc_rolling_volatility(sample_prices_daily, lookback = 20)
stability_signal <- align_to_timeframe(daily_vol, sample_prices_weekly$Date)
weights <- weight_by_signal(selected, stability_signal)

PortfolioTesteR documentation built on Nov. 5, 2025, 5:23 p.m.