ledgr_run() is the public single-run API for the v0.1.7
experiment-first workflow. It evaluates run-time feature definitions,
builds the canonical backtest config, and delegates to the shared runner.
Usage
ledgr_run(exp, params = list(), run_id = NULL, seed = NULL)Articles
Strategy authoring:
vignette("strategy-development", package = "ledgr")
system.file("doc", "strategy-development.html", package = "ledgr")
Metrics and accounting:
vignette("metrics-and-accounting", package = "ledgr")
system.file("doc", "metrics-and-accounting.html", package = "ledgr")
Examples
bars <- data.frame(
ts_utc = as.POSIXct("2020-01-01", tz = "UTC") + 86400 * 0:2,
instrument_id = "AAA",
open = c(100, 101, 102),
high = c(101, 102, 103),
low = c(99, 100, 101),
close = c(100, 101, 102),
volume = 1000
)
snapshot <- ledgr_snapshot_from_df(bars)
strategy <- function(ctx, params) {
targets <- ctx$flat()
targets["AAA"] <- params$qty
targets
}
exp <- ledgr_experiment(snapshot, strategy)
bt <- ledgr_run(exp, params = list(qty = 1), run_id = "example-run")
close(bt)
ledgr_snapshot_close(snapshot)