Module dual_mode_features

Source
Expand description

Dual-mode feature calculation for both scalar and vectorized operations. Dual-mode feature calculation framework

Supports both real-time streaming and batch vectorized calculations with identical results guaranteed between modes.

§Memory Management Strategy

This module implements a size-based boxing strategy for enum variants containing large data structures. The strategy uses compile-time size calculations and a 1KB threshold to determine when to box variants:

  • Stack allocation (< 1KB): Direct storage for optimal cache performance
  • Heap allocation (≥ 1KB): Boxed storage to prevent stack overflow

This approach ensures predictable memory allocation patterns while maintaining high performance for small variants and preventing stack overflow for large ones.

Re-exports§

pub use DualModeOFI32 as DefaultDualModeOFI;
pub use MarketUpdate32 as DefaultMarketUpdate;

Structs§

DualModeBookSlope
Order Book Slope dual-mode implementation Order Book Slope dual-mode implementation.
DualModeKyleLambda
Kyle’s Lambda dual-mode implementation Kyle’s Lambda dual-mode implementation.
DualModeOFI
Order Flow Imbalance (OFI) dual-mode implementation Order Flow Imbalance (OFI) dual-mode implementation.
DualModeVPIN
VPIN (Volume-Synchronized Probability of Informed Trading) dual-mode implementation.
FeatureEngine
Feature calculation engine that manages multiple features
FeatureEngineBuilder
Builder for creating feature engines with common HFT features
MarketData
Market data for batch calculation Market data for batch calculation.
MarketUpdate
Market data for incremental calculation
TradeUpdate
Trade update for incremental calculation Trade update for incremental calculation.

Enums§

CalculationMode
The calculation mode for the feature engine.
FeatureValue
Feature value that can hold different types Feature value that can hold different types.
TradeSide
The side of a trade.

Traits§

DualModeFeature
Trait for features that support both real-time and batch calculation

Type Aliases§

DualModeOFI5
Type alias for a dual-mode OFI feature with 5 levels capacity.
DualModeOFI8
Type alias for a dual-mode OFI feature with 8 levels capacity.
DualModeOFI16
Type alias for a dual-mode OFI feature with 16 levels capacity.
DualModeOFI32
Type alias for a dual-mode OFI feature with 32 levels capacity.
DualModeOFI64
Type alias for a dual-mode OFI feature with 64 levels capacity.
DualModeOFI128
Type alias for a dual-mode OFI feature with 128 levels capacity.
MarketUpdate32
Type alias for a market update with 32 order book levels and 16 trade records capacity.
MarketUpdate64
Type alias for a market update with 64 levels and 32 trades capacity.
MarketUpdate128
Type alias for a market update with 128 levels and 64 trades capacity.