Skip to main content

Strategy

Trait Strategy 

pub trait Strategy: Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn on_event(
        &mut self,
        ctx: &StrategyContext<'_>,
        event: &Event,
    ) -> Vec<OrderIntent>;

    // Provided method
    fn market_types(&self) -> Option<&'static [MarketDataType]> { ... }
}
Expand description

The core strategy trait — the stable boundary between platform and proprietary trading logic.

§Object Safety

This trait is object-safe: no generics, no -> Self, no associated types. The runner stores strategies as Box<dyn Strategy>.

§Threading

Strategies must be Send to support cross-thread dispatch.

Required Methods§

fn name(&self) -> &'static str

Human-readable strategy name (used for logging and journal tagging).

fn on_event( &mut self, ctx: &StrategyContext<'_>, event: &Event, ) -> Vec<OrderIntent>

Called on every event. Returns zero or more order intents for the risk gateway to evaluate.

Provided Methods§

fn market_types(&self) -> Option<&'static [MarketDataType]>

Market data types this strategy consumes.

When None (the default), all market data types are delivered. The platform computes the union of all active strategies’ requirements and filters at the feed level — strategies that return None cause all types to be delivered for every strategy.

Implementors§