Skip to contents

Creates reproducible synthetic daily bars for examples, documentation, and local experimentation. The generator uses a simple log-return process with instrument-specific drift and volatility, overnight gaps, and intraday high and low ranges. It uses only base R and does not access the network.

Usage

ledgr_sim_bars(
  n_instruments = 10L,
  n_days = 252L * 5L,
  seed = 1L,
  start = "2018-01-01",
  instrument_prefix = "DEMO_"
)

Arguments

n_instruments

Number of synthetic instruments.

n_days

Number of business-day bars per instrument.

seed

Random seed used for deterministic generation.

start

First calendar date considered for the business-day sequence.

instrument_prefix

Prefix used for generated instrument IDs.

Value

A tibble with ts_utc, instrument_id, open, high, low, close, and volume columns suitable for ledgr_snapshot_from_df().

Examples

bars <- ledgr_sim_bars(n_instruments = 3, n_days = 20, seed = 1)
head(bars)
#> # A tibble: 6 × 7
#>   ts_utc              instrument_id  open  high   low close volume
#>   <dttm>              <chr>         <dbl> <dbl> <dbl> <dbl>  <dbl>
#> 1 2018-01-01 00:00:00 DEMO_01        55.0  56.1  55.0  55.5 475371
#> 2 2018-01-02 00:00:00 DEMO_01        55.4  56.2  55.3  56.0 528369
#> 3 2018-01-03 00:00:00 DEMO_01        56.1  56.4  55.5  55.9 452126
#> 4 2018-01-04 00:00:00 DEMO_01        56.0  56.1  54.8  55.0 537642
#> 5 2018-01-05 00:00:00 DEMO_01        54.9  55.5  54.6  55.4 472633
#> 6 2018-01-08 00:00:00 DEMO_01        55.3  55.5  55.0  55.3 666383