Print a backtest result
Usage
# S3 method for class 'ledgr_backtest'
print(x, ...)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)
print(bt)
#> ledgr Backtest Results
#> ======================
#>
#> Run ID: run_539c82d39bd15fc6
#> Universe: AAA
#> Date Range: 2020-01-01T00:00:00Z to 2020-01-03T00:00:00Z
#> Execution Mode: audit_log
#> Initial Cash: $1000.00
#> Final Equity: $1001.00
#> P&L: $1.00 (0.10%)
#>
#> Use summary(bt) for detailed metrics
#> Use plot(bt) for equity curve visualization
close(bt)