of_core 0.1.2

Core domain models and analytics primitives for the Orderflow engine
Documentation
  • Coverage
  • 98.44%
    63 out of 64 items documented1 out of 18 items with examples
  • Size
  • Source code size: 15.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 31s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • gregorian-09/orderflow
    3 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gregorian-09

of_core

of_core defines the canonical data model and analytics primitives used across the Orderflow stack. It is provider-agnostic and intentionally lightweight so every binding (C, Python, Java) can rely on the same normalized semantics.

What This Crate Contains

  • Market identity: [SymbolId]
  • Event model: [TradePrint], [BookUpdate], [Side], [BookAction]
  • Quality flags: [DataQualityFlags]
  • Runtime outputs: [AnalyticsSnapshot], [SignalSnapshot], [SignalState]
  • Deterministic analytics engine: [AnalyticsAccumulator]

Design Principles

  • Deterministic arithmetic: prices and sizes are integer values, avoiding float drift in replay/backtests.
  • Stable schema: types are designed for cross-language transport and long-lived storage.
  • Minimal dependencies: this crate stays small so it can be embedded broadly.

Quick Start

use of_core::{AnalyticsAccumulator, Side, SymbolId, TradePrint};

let symbol = SymbolId {
    venue: "CME".to_string(),
    symbol: "ESM6".to_string(),
};

let mut acc = AnalyticsAccumulator::default();
acc.on_trade(&TradePrint {
    symbol,
    price: 505_000,
    size: 10,
    aggressor_side: Side::Ask,
    sequence: 1,
    ts_exchange_ns: 1,
    ts_recv_ns: 2,
});

let snap = acc.snapshot();
assert_eq!(snap.buy_volume, 10);
assert_eq!(snap.delta, 10);

Quality Flags

[DataQualityFlags] is a bitset used to express data-health issues such as stale feed, sequence gaps, and out-of-order events. Signals and runtime gating can use these flags to block unsafe decisions.

use of_core::DataQualityFlags;

let q = DataQualityFlags::STALE_FEED | DataQualityFlags::SEQUENCE_GAP;
assert!(q.intersects(DataQualityFlags::STALE_FEED));
assert_eq!(q.bits() & DataQualityFlags::SEQUENCE_GAP.bits(), DataQualityFlags::SEQUENCE_GAP.bits());

Analytics Model Notes

  • delta tracks current session directional imbalance.
  • cumulative_delta retains directional accumulation over time.
  • point_of_control is computed as highest-volume price level.
  • value_area_low / value_area_high approximate the high-volume range around POC.

For full orchestration and adapter integration, see of_runtime.