Skip to contents

A strategy schedule is a declarative calendar rule. It is compiled once, before execution, against the snapshot's authoritative open-session axis. The decorated strategy remains an ordinary function(ctx, params); the schedule does not wrap or call it.

Usage

ledgr_strategy_schedule(strategy, schedule)

ledgr_schedule_month_start()

ledgr_schedule_month_end()

ledgr_schedule_week_start()

ledgr_schedule_quarter_start()

ledgr_schedule_year_start()

ledgr_schedule_dates(dates)

ledgr_schedule_weekday(day)

ledgr_schedule_month_day(day)

ledgr_schedule_from_param(name)

Arguments

strategy

A strategy function with signature function(ctx, params).

schedule

A schedule made by one of the ledgr_schedule_*() helpers.

dates

Civil dates. Each date is snapped forward to the next open venue session; duplicates after snapping are removed.

day

For ledgr_schedule_weekday(), one exact lowercase English weekday name from "monday" through "sunday". For ledgr_schedule_month_day(), one whole number from 1 through 31.

name

Name of a scalar character strategy parameter resolving to one of the fixed schedule names.

Value

strategy, with class ledgr_scheduled_strategy and a declarative ledgr_schedule attribute.

Details

Fixed calendar rules select real boundaries on the complete parent session axis. They do not manufacture a boundary at the start or end of a partial run; in particular, the first parent-axis session is not automatically a start boundary. Weekday and numbered month-day rules select the first open session on or after their anchor, but only inside the same civil week or month. Thus a closed Friday does not move a Friday decision into Monday, and Saturday or Sunday rules decide only on venues that actually open then. A numbered day before the first open session on the parent axis is unproved and does not manufacture a decision; this is why ledgr_schedule_month_day(1) can differ from ledgr_schedule_month_start(). Explicit civil dates snap forward to the next open session; a date outside the declared parent axis is refused, while a date inside that axis but outside the executable window is simply not due. A parameter schedule resolves a named scalar character strategy parameter to one of "month_start", "month_end", "week_start", "quarter_start", or "year_start" before execution.

Schedules currently require an availability-aware axis with exactly one pulse per expected venue session. Dense and multi-pulse intraday runs refuse the declaration. On a non-decision pulse ledgr skips decision-context construction, callback invocation and execution planning, but still performs observation, economic-event settlement, reconciliation, strategy-state persistence, interruption checks, checkpoints and commit processing. This scheduled_skip is distinct from an explicit ctx$hold() returned by an invoked strategy.

A schedule that resolves to no decision pulses refuses a flat run before fold entry. A run with opening or carried positions may proceed and carry them. The canonical declaration and hash are part of configuration and orchestration identity, while the inner strategy's source identity remains unchanged. The compiled decision mask is ephemeral and is not persisted.

Examples

strategy <- function(ctx, params) ctx$hold()
wednesday_strategy <- ledgr_strategy_schedule(
  strategy,
  ledgr_schedule_weekday("wednesday")
)
monthly_strategy <- ledgr_strategy_schedule(
  strategy,
  ledgr_schedule_month_day(15)
)