Print a backtest result
Usage
# S3 method for class 'ledgr_backtest'
print(x, ...)Details
The ordinary print includes the headline corporate-action fidelity and declares when the execution-bar price basis was not supplied. Availability-aware runs add one valuation headline: current, stale or frozen. When any holding froze or any terminal outcome rested on an assumption rather than settlement evidence, one warning precedes the metrics; it has no materiality threshold.
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, cost_model = ledgr_cost_zero())
print(bt)
#> ledgr Backtest Results
#> ======================
#>
#> Run ID: run_c7475d4e722c9e2a
#> Period: 2020-01-01 to 2020-01-03
#> Opening Cash: $1000.00
#> Final Equity: $1001.00
#> Total Return: 0.10%
#> Max Drawdown: 0.00%
#> Closed Trades: 0
#> Metric Calendar: US equity daily (default) (252 days/year * 1 bars/day = 252 bars/year)
#>
#> Economic events: NOT SUPPLIED - returns may omit distributions
#> Price basis: UNDECLARED - distribution double counting cannot be ruled out
#>
#> Use summary(bt) for metrics and evidence
close(bt)