Skip to content

Events

All events inherit from the base Event class and are ordered chronologically by timestamp.

MarketDataEvent

MarketDataEvent dataclass

Bases: Event

Represents a market data event.

Source code in alphaflow/events/market_data_event.py
@dataclass(frozen=True)
class MarketDataEvent(Event):
    """Represents a market data event."""

    #: The timestamp of the event.
    timestamp: datetime

    #: The symbol of the market data.
    symbol: str

    #: The open price of the bar.
    open: float

    #: The high price of the bar.
    high: float

    #: The low price of the bar.
    low: float

    #: The close price of the bar.
    close: float

    #: The volume of the bar.
    volume: float

OrderEvent

OrderEvent dataclass

Bases: Event

Represents an order event.

Source code in alphaflow/events/order_event.py
@dataclass(frozen=True)
class OrderEvent(Event):
    """Represents an order event."""

    #: The timestamp of the order.
    timestamp: datetime

    #: The symbol of the order.
    symbol: str

    #: The side of the order.
    side: Side

    #: The quantity of the order.
    qty: float

    #: The order type of the order.
    order_type: OrderType

    #: The limit price of the order, if applicable.
    limit_price: float | None = None

FillEvent

FillEvent dataclass

Bases: Event

Represents a fill event.

Source code in alphaflow/events/fill_event.py
@dataclass(frozen=True)
class FillEvent(Event):
    """Represents a fill event."""

    #: The timestamp of the fill.
    timestamp: datetime

    #: The symbol of the fill.
    symbol: str

    #: The side of the fill.
    fill_price: float

    #: The quantity of the fill.
    fill_qty: float

    #: The commission of the fill.
    commission: float