Skip to Content

lacuna.events

Event windows and event response.

Generated from Lacuna 0.14.3. For what these do and when to use them, read the guide.

Classes

EventWindowResult

class EventWindowResult(evidence: AnalysisResult)

Immutable event-path rows plus alignment and coverage evidence.

FieldTypeDefault
evidenceAnalysisResultrequired

EventWindowResult.frame

frame: pl.DataFrame

Return a shallow clone of result-owned event rows.

EventWindowResult.metadata

metadata: ResultMetadata

Expose window-construction provenance.

EventWindowResult.to_json

def to_json(*, indent: int | None = 2) -> str

Serialize compact evidence without embedding every event path row.

Functions

event_response

def event_response(
    windows: EventWindowResult,
    *,
    confidence: float = 0.95,
    resamples: int = 2000,
    expected_block_length: float | None = None,
    seed: int | None = None,
    min_clusters: int = 20,
) -> AnalysisResult

Estimate event response with stationary bootstrap over anchor-time clusters.

event_windows

def event_windows(
    events: object,
    prices: object,
    *,
    event_id: str = 'event_id',
    instrument: str = 'instrument',
    event_time: str = 'event_time',
    available_time: str = 'available_time',
    price_time: str = 'time',
    price: str = 'close',
    anchor: AnchorPolicy = 'available_time',
    before: int = 5,
    after: int = 10,
    alignment: Literal['next_observation'] = 'next_observation',
    overlap_policy: OverlapPolicy = 'raise',
    price_adjustment: str = 'unknown',
) -> EventWindowResult

Align events to the first price observation at or after an explicit anchor.