Skip to main content

PulseIndex

PulseIndex is a class that manages a list of datetimes and allows pulsing through them. It keeps every component in sync with the current datetime index. Initialize the PulseIndex with a list of datetimes. Parameters

PulseIndex.datetimes

property
Get the list of datetimes in the pulse index. Returns

PulseIndex.last_pulse

property
Get the last pulse time. Returns

PulseIndex.pulses_per_year

cached property
Cadence rate as periods-per-calendar-year. Used to annualize per-pulse return metrics (Sharpe, Sortino, etc.). Formula: len(datetimes) * 365 / span_calendar_days. Examples: SPX daily backtest (~252 datetimes spanning ~365 days) -> ~252. BTC hourly 24/7 (~8760 over 365 days) -> ~8760. SPX hourly 6.5h sessions (~1638 over 365 days) -> ~1638. Cached on first access. Invalidated by append.

PulseIndex.index

property
Get the current index in the pulse index. Returns: int: Current index in the pulse index.

PulseIndex.__clear_cache

Drop the cached pulses_per_year so the next access recomputes over the new calendar. functools.cached_property stores its value in the instance __dict__ under the property’s own name (shadowing the descriptor); popping it re-exposes the getter. No-op when the property was never accessed.

PulseIndex.append

Append a new datetime to the pulse index. Parameters

PulseIndex.extend

Append the datetimes past the current last one (backtest continuation). Tail-only: entries at or before the current last datetime are ignored, so passing a full re-derived calendar and passing just the new datetimes both work. datetimes is assumed sorted. The cursor stays where it is, so a finished run resumes on the first new datetime. Parameters

PulseIndex.pulse

Advance the pulse index to the next datetime.

PulseIndex.has_next

Check if there is a next pulse. Returns

PulseIndex.peek_next

The datetime the next pulse would land on, or None at the end. Lets callers test “is this the next pulse” without reaching into the index arithmetic. Returns

PulseIndex.advance_to

Fast-forward the cursor to the latest datetime <= target (assumes sorted datetimes). A one-shot seek used to skip a leading span without pulsing through it step by step. When target precedes the first datetime the cursor stays at index 0; when it is at or past the last, it lands on the last. Parameters

PulseIndex.pulse_history

Get the pulse history at a specific index. Parameters Returns

common_settlements

The settlement datetimes every one of underlying_ids has: a pulse calendar. Per underlying this is pdc’s available_settlements(uid, unified=True), which already intersects that underlying’s instrument families and returns them sorted and deduplicated. Intersecting across underlyings is the one step pdc does not offer, so it lives here, once: the engine’s EnvironmentBuilder and the framework’s executor and shadow evaluation all call this rather than each keeping a copy. Parameters Raises

pulses_per_year

Cadence rate of datetimes as periods-per-calendar-year. Formula: len(datetimes) * 365 / span_calendar_days. Falls back to 252.0 (pulse.metrics._core.NUMBER_OF_TRADING_DAYS_PER_YEAR, the daily-cadence default; not imported here to keep pulse.core.time dependency-free) for fewer than two datetimes or a non-positive span. The single definition behind PulseIndex.pulses_per_year, also usable on any raw datetime list (e.g. an aggregated pool curve).

aggregate_per_pulse_to_daily

Group per-pulse values by date and collapse each group. Parameters Returns
Last modified on November 4, 2026