SignalAI

Events & types

The value types your handlers receive and the scalars you build orders from. All come in through the prelude (use signalai_quant::prelude::*;).

Bar

One period of market data, delivered to on_bar.

FieldTypeMeaning
symbolSymbolIdWhich instrument
tsi64Bar time (nanoseconds, UTC)
open / high / low / closePriceOHLC — read with .as_f64()
volumef64Traded volume
resolutionResolutionDay1 or Min1
fn on_bar(&mut self, ctx: &mut Ctx, bar: &Bar) {
    let close = bar.close.as_f64();
}

Price and Qty

Fixed-point newtypes (not raw floats), so prices and sizes are exact.

  • Read: .as_f64().
  • Build: Price::from_f64(184.22), Qty::shares(10.0).
  • Qty helpers: .is_zero().

Side

Order direction: Side::Buy, Side::Sell.

OrderType

OrderType::Market, OrderType::Limit.

Resolution

Bar resolution: Resolution::Day1 (daily), Resolution::Min1 (minute).

Trade / Quote

Tick-level market data, delivered to on_trade / on_quote when you subscribe with ctx.subscribe_trades(sym) / ctx.subscribe_quotes(sym). Each carries the instrument, a timestamp, and the print/quote prices and sizes.

OrderEvent

Delivered to on_order as an order changes state. Keyed by the OrderId returned from ctx.order(...), carrying the OrderStatus and fill detail (filled quantity, fill price). Orders enqueue and fill as later events — see Fills.

OrderStatus

The order state on an OrderEvent: Submitted, PartiallyFilled, Filled, Cancelled, Rejected.

Timer

Delivered to on_timer for intervals you register with ctx.every("7d"). Carries the fire time.