Learn R Programming

PortfolioTesteR (version 0.1.4)

run_param_grid: Run Parameter Grid Optimization (safe + ergonomic)

Description

Run Parameter Grid Optimization (safe + ergonomic)

Usage

run_param_grid(
  prices,
  grid,
  builder,
  metric = NULL,
  name_prefix = "Strategy",
  verbose = FALSE,
  light_mode = TRUE,
  precompute_returns = TRUE,
  builder_args = list(),
  n_cores = 1,
  fixed = NULL
)

Value

param_grid_result

Arguments

prices

Data frame with Date + symbol columns

grid

Data frame (each row = a combo) OR a named list of vectors

builder

Function(prices, params, ...) -> weights (Date + symbols)

metric

Scoring function(backtest) -> numeric. Defaults to metric_sharpe.

name_prefix

String prefix for backtest names

verbose

Logical

light_mode

Logical: speed-ups in backtest

precompute_returns

Logical: precompute log-returns once (light_mode only)

builder_args

List of extra args forwarded to builder (e.g., caches)

n_cores

Integer (kept for API compatibility; ignored here)

fixed

Optional named list of constant parameters merged into every combo. If a name appears in both grid and fixed, the fixed value wins and that column is pruned from the grid (fewer duplicate combos; clearer counts).