Skip to contents

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.

Usage

ledgr_opening(cash, date = NULL, positions = NULL, cost_basis = NULL)

Arguments

cash

Finite non-negative cash balance.

date

Optional opening timestamp. NULL lets ledgr choose the first valid pulse after indicator warmup.

positions

Optional named numeric vector of starting long positions.

cost_basis

Optional named numeric vector with the same names as positions.

Value

A ledgr_opening object.

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