Skip to contents

Reads a CSV file and delegates to ledgr_snapshot_from_df().

Usage

ledgr_snapshot_from_csv(csv_path, db_path = NULL, snapshot_id = NULL)

Arguments

csv_path

Path to a bars CSV file.

db_path

Optional DuckDB file path (default: tempfile).

snapshot_id

Optional snapshot id (default: v0.1.1 canonical generation).

Value

A ledgr_snapshot object.

Articles

Durable experiment stores: vignette("experiment-store", package = "ledgr") system.file("doc", "experiment-store.html", package = "ledgr")

Examples

csv_path <- tempfile(fileext = ".csv")
utils::write.csv(data.frame(
  ts_utc = c("2020-01-01T00:00:00Z", "2020-01-02T00:00:00Z"),
  instrument_id = "AAA",
  open = c(100, 101),
  high = c(101, 102),
  low = c(99, 100),
  close = c(100, 101),
  volume = 1000
), csv_path, row.names = FALSE)
snapshot <- ledgr_snapshot_from_csv(csv_path)
ledgr_snapshot_info(snapshot)
#> # A tibble: 1 × 11
#>   snapshot_id        status created_at_utc sealed_at_utc snapshot_hash bar_count
#>   <chr>              <chr>  <chr>          <chr>         <chr>             <int>
#> 1 snapshot_20260515… SEALED 2026-05-15T16… 2026-05-15T1… cdce2950fdab…         2
#> # ℹ 5 more variables: instrument_count <int>, start_date <chr>, end_date <chr>,
#> #   meta_json <chr>, error_msg <chr>
ledgr_snapshot_close(snapshot)