pub trait Strategy: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn instruments(&self) -> &[InstrumentId];
fn process_trade<'life0, 'async_trait>(
&'life0 self,
trade: MarketTrade,
) -> Pin<Box<dyn Future<Output = Result<SmallSignalVec<Signal>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn process_depth<'life0, 'async_trait>(
&'life0 self,
depth: OrderBookSnapshot,
) -> Pin<Box<dyn Future<Output = Result<SmallSignalVec<Signal>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn process_bar<'life0, 'async_trait>(
&'life0 self,
bar: Bar,
) -> Pin<Box<dyn Future<Output = Result<SmallSignalVec<Signal>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_from_orderbook<'life0, 'async_trait>(
&'life0 self,
order_book: Arc<SharedSimdOrderBook>,
) -> Pin<Box<dyn Future<Output = Result<SmallSignalVec<Signal>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn on_timer<'life0, 'async_trait>(
&'life0 self,
timestamp_ns: u64,
) -> Pin<Box<dyn Future<Output = Result<SmallSignalVec<Signal>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The Strategy trait defines the interface for all trading strategies.
Required Methods§
Sourcefn instruments(&self) -> &[InstrumentId]
fn instruments(&self) -> &[InstrumentId]
Returns a list of instruments that this strategy is interested in