Expand description
Canonical event normalization — typed conversion from raw exchange events to a strict shape suitable for indicators/storage/backtest.
§Invariants
price/quantityfields arerust_decimal::Decimal— no f64 rounding.timestamp_msis always UTC milliseconds regardless of source unit (s / ms / µs / ns).sideusesTradeSide(Buy/Sell) for trades.symbolis raw exchange-native (from Phase α — no internal normalization here).
§Usage
use digdigdig3::core::normalization::{Canonicalize, CanonicalEvent};
// Given a StreamEvent from any exchange WebSocket:
// if let Some(canonical) = event.canonicalize() {
// match canonical {
// CanonicalEvent::Trade(t) => println!("price={} qty={}", t.price, t.quantity),
// _ => {}
// }
// }Structs§
- Canonical
Kline - Canonical OHLCV kline.
- Canonical
Level - A single canonical price level (bid or ask).
- Canonical
Orderbook - Canonical orderbook snapshot.
- Canonical
Orderbook Delta - Canonical incremental orderbook update.
- Canonical
Ticker - Canonical 24-hour ticker snapshot.
- Canonical
Trade - Canonical trade — every field strict, no nulls, no f64.
Enums§
- Canonical
Event - Unified canonical event — output of
CanonicalizeonStreamEvent.
Traits§
- Canonicalize
- Conversion to a canonical typed form.
Functions§
- normalize_
ts_ to_ ms - Normalize a raw exchange timestamp to UTC milliseconds.