Skip to main content

Module events

Module events 

Source
Expand description

Canonical events delivered by the engine to strategies.

Events are the read-side API for strategies. Market polling, fill polling, account snapshots, and exchange health changes are normalized into this enum before strategy code sees them.

§Example

use bot_core::{Event, ExchangeId, InstrumentId, Price, QuoteEvent};
use rust_decimal::Decimal;

let event = Event::Quote(QuoteEvent {
    exchange: ExchangeId::new("hyperliquid"),
    instrument: InstrumentId::new("BTC-PERP"),
    bid: Price::new(Decimal::new(64_990, 0)),
    ask: Price::new(Decimal::new(65_010, 0)),
    ts: 1_700_000_000_000,
});

assert_eq!(event.instrument().unwrap().as_str(), "BTC-PERP");
assert_eq!(event.ts(), 1_700_000_000_000);

Structs§

ExchangeStateChangedEvent
Exchange state changed (Active <-> Halted)
FundingRateEvent
Funding rate changed
OrderAcceptedEvent
Order accepted by exchange
OrderCanceledEvent
Order canceled
OrderCompletedEvent
Order completed (terminal: fully filled)
OrderFilledEvent
Order filled (partial or full) - derived from userFills
OrderRejectedEvent
Order rejected by exchange (or locally by engine)
QuoteEvent
Quote update (bid/ask)

Enums§

Event
Events that strategies can receive.