Skip to main content
Every pipeline function receives a Context object with live data about feeds, inventory, the current market, engine status, and custom parameters.

Context Structure

FeedData

Each entry in ctx.feeds is a FeedData snapshot from the engine’s feed manager:

Accessing feeds

Always use .get() with a default FeedData() to handle the case where a feed hasn’t received data yet.

Feed staleness

FeedData includes a staleness check:
In live mode, the strategy loop automatically skips quoting for markets when any feed is stale (default threshold: 30 seconds). You can configure this via params:

InventorySnapshot

ctx.inventory provides the current position state:

Inventory-based quoting

Per-market inventory

Market

ctx.market is the Market object currently being quoted:
See Types Reference for all Market fields.

Event

ctx.event is set when trading multi-outcome events (via hz.run(events=...)). It is None for standard binary market strategies.
See Multi-Outcome Events for the full guide.

EngineStatus

ctx.status provides engine-level metrics:

Custom Parameters

Pass arbitrary parameters via hz.run(params=...) and access them in pipeline functions: