pub struct FeatureEngineBuilder { /* private fields */ }Expand description
Builder for creating feature engines with common HFT features
Implementations§
Source§impl FeatureEngineBuilder
impl FeatureEngineBuilder
Sourcepub fn new(mode: CalculationMode) -> Self
pub fn new(mode: CalculationMode) -> Self
Creates a new FeatureEngineBuilder with the given calculation mode.
Sourcepub fn with_ofi(self, window_size: usize, capacity: usize) -> Self
pub fn with_ofi(self, window_size: usize, capacity: usize) -> Self
Add OFI feature with configurable capacity
This method allows you to specify both the window size and the capacity for the order book levels. The capacity determines how many bid/ask levels can be stored inline without heap allocation.
§Arguments
window_size- The size of the rolling window for OFI calculationcapacity- The maximum number of order book levels to store inline
§Supported Capacities
Common capacities are optimized for specific use cases:
- 5: Top-of-book strategies
- 8: Lightweight strategies
- 16: Compact strategies
- 32: Standard market making (default)
- 64: Deep market making
- 128: Full depth analysis
§Examples
// Default capacity (32)
let engine = FeatureEngineBuilder::new(CalculationMode::RealTime)
.with_ofi(10, 32)
.build();
// High-frequency market maker needing more levels
let engine = FeatureEngineBuilder::new(CalculationMode::RealTime)
.with_ofi(10, 64)
.build();Sourcepub fn with_ofi_default(self, window_size: usize) -> Self
pub fn with_ofi_default(self, window_size: usize) -> Self
Add OFI feature with default capacity (32) for backward compatibility
This is a convenience method that uses the default capacity of 32 levels.
For custom capacities, use with_ofi(window_size, capacity) instead.
Sourcepub fn with_ofi_5(self, window_size: usize) -> Self
pub fn with_ofi_5(self, window_size: usize) -> Self
Add OFI feature with 5 levels capacity (top-of-book strategies)
Sourcepub fn with_ofi_8(self, window_size: usize) -> Self
pub fn with_ofi_8(self, window_size: usize) -> Self
Add OFI feature with 8 levels capacity (lightweight strategies)
Sourcepub fn with_ofi_16(self, window_size: usize) -> Self
pub fn with_ofi_16(self, window_size: usize) -> Self
Add OFI feature with 16 levels capacity (compact strategies)
Sourcepub fn with_ofi_32(self, window_size: usize) -> Self
pub fn with_ofi_32(self, window_size: usize) -> Self
Add OFI feature with 32 levels capacity (standard market making)
Sourcepub fn with_ofi_64(self, window_size: usize) -> Self
pub fn with_ofi_64(self, window_size: usize) -> Self
Add OFI feature with 64 levels capacity (deep market making)
Sourcepub fn with_ofi_128(self, window_size: usize) -> Self
pub fn with_ofi_128(self, window_size: usize) -> Self
Add OFI feature with 128 levels capacity (full depth analysis)
Sourcepub fn with_kyle_lambda(self, window_size: usize) -> Self
pub fn with_kyle_lambda(self, window_size: usize) -> Self
Add Kyle’s Lambda feature
Sourcepub fn with_book_slope(self, depth: usize) -> Self
pub fn with_book_slope(self, depth: usize) -> Self
Add Order Book Slope feature
Sourcepub fn build(self) -> FeatureEngine
pub fn build(self) -> FeatureEngine
Build the feature engine