ledgr_opening() creates the explicit starting state used by the v0.1.7
experiment-first workflow. It records starting cash and, optionally, existing
long positions and cost basis.
Arguments
- cash
Finite positive cash balance.
- date
Optional opening timestamp or civil Date. It is also the scoring start: runs, sweeps, promotion and feature precompute evaluate the strategy and start feature state from the first pulse at or after it, so indicators warm up again from this date and earlier bars are not read. For an availability- aware experiment a Date resolves to the unique declared venue-session open and refuses if there is no unique match; POSIXct remains an exact instant.
NULL, or an exact instant before the snapshot, starts at the snapshot start.- positions
Optional named numeric vector of starting long positions.
- cost_basis
Optional named numeric vector with the same names as
positions.
Examples
ledgr_opening(cash = 100000)
#> ledgr_opening
#> ==============
#> Cash: 100000
#> Date: <auto>
#> Positions: 0
ledgr_opening(
cash = 25000,
positions = c(AAA = 10, BBB = 5),
cost_basis = c(AAA = 101.25, BBB = 98.50)
)
#> ledgr_opening
#> ==============
#> Cash: 25000
#> Date: <auto>
#> Positions: 2
#> Instruments: AAA, BBB