Skip to contents

ledgr_history_info() returns what a ledgr_history_frame() result recorded about itself, so a strategy or an inspection never reads the "ledgr_history" attribute directly: its source, causal cutoff, data start and returned-window start, requested and available lookback, the selection table with every exclusion reason, the included and excluded instrument IDs, and whether any returned value used observations or calculation state before the returned window. Like ledgr_history_matrix() it first checks that the result still matches its recorded axis and instruments, and it reads no data.

Usage

ledgr_history_info(x)

Arguments

x

A ledgr_history result.

Value

A ledgr_history_info list with source (the bar:<field> or feature:<id> label), source_kind, source_id, cutoff_utc, data_start_utc, window_start_utc, requested_lookback, available_lookback, instruments (the selector: "admissible", "decision_axis" or "explicit"), min_observations, min_instruments, passed_warmup, layout, used_before_window, included_ids, excluded_ids (requested but not included), selection (a tibble with one row per requested or decision-axis instrument: requested, included, exclusion_reason, on_decision_axis, admissible, admissibility_reason, required_input_count, carried_input_count and carried_input_share), policy_identity and snapshot_hash. Ordinary results contain no cell-aligned evidence; request layout = "long" when cell diagnostics are needed.

Details

Excluded instruments are estimation evidence only. An instrument that min_observations left out of the estimator sample still needs a target: ledgr_target_rebalance() targets a held instrument that is not in its weights to zero unless the strategy passes it in keep, and excluded_ids is the list to consult for that choice.

Articles

Reading causal history: vignette("causal-history", package = "ledgr") system.file("doc", "causal-history.html", package = "ledgr")

Examples

if (FALSE) { # \dontrun{
strategy <- function(ctx, params) {
  returns <- ctx |>
    ledgr_history_frame(feature = "return_1", lookback = 20L,
                        min_instruments = 3L)
  info <- ledgr_history_info(returns)
  info$excluded_ids
  ctx$hold()
}
} # }