Summarize per-pulse telemetry
Arguments
- bt
A
ledgr_backtestobject. This function does not accept a DuckDB file path; useledgr_run_info()for persisted run-level telemetry.
Details
This is a diagnostic helper for engine profiling. It only reports detailed
telemetry captured for runs executed in the current R session. Timing
components are reported in seconds; feature-cache hit/miss rows are counts.
The compact telemetry persisted in durable experiment stores is available
through ledgr_run_info().
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
)
strategy <- function(ctx, params) {
targets <- ctx$flat()
targets["AAA"] <- 1
targets
}
bt <- ledgr_backtest(data = bars, strategy = strategy, initial_cash = 1000)
ledgr_backtest_bench(bt)
#> # A tibble: 13 × 4
#> component mean median p99
#> <chr> <dbl> <dbl> <dbl>
#> 1 t_pre 0.904 0.904 0.904
#> 2 t_post 0.0120 0.0120 0.0120
#> 3 t_loop 0.0120 0.0120 0.0120
#> 4 t_pulse NA NA NA
#> 5 t_bars NA NA NA
#> 6 t_ctx NA NA NA
#> 7 t_fill NA NA NA
#> 8 t_state NA NA NA
#> 9 t_feats NA NA NA
#> 10 t_strat NA NA NA
#> 11 t_exec NA NA NA
#> 12 feature_cache_hits 0 0 0
#> 13 feature_cache_misses 0 0 0
close(bt)