Subscriptions

Live data, backfill and resume.

class mirexa.Subscription(client: Client, state: SubState)

An iterator of Event. Close it, or use it as a context manager.

property addr: str

The node this subscription is on.

property redirects: int

Redirects followed: times the stream was found on, or moved to, another node.

next(timeout: float | None = None) → Event | None

The next event, or None if none arrives within timeout seconds.

close() → None

Unsubscribe and close this subscription’s connection.

class mirexa.AsyncSubscription(client: AsyncClient, state: SubState)

An async iterator of Event. Close it, or use async with.

property addr: str

The node this subscription is on.

property redirects: int

Redirects followed: times the stream was found on, or moved to, another node.

async next(timeout: float | None = None) → Event | None

The next event, or None if none arrives within timeout seconds.

async close() → None

Unsubscribe and close this subscription’s connection.

class mirexa.Event(sequence: int, backfill: bool, live: bool, candles: list[Candle], ticks: list[Tick], dropped: int = 0)

One batch from a subscription.

dropped: int = 0

Live batches the server dropped just before this one (it could not queue them because this subscriber was behind).