Skip to main content

Module interbar

Module interbar 

Source
Expand description

Inter-bar microstructure features computed from lookback trade windows

GitHub Issue: https://github.com/terrylica/opendeviationbar-py/issues/59

This module provides features computed from trades that occurred BEFORE each bar opened, enabling enrichment of larger open deviation bars (e.g., 1000 dbps) with finer-grained microstructure signals without lookahead bias.

§Temporal Integrity

All features are computed from trades with timestamps strictly BEFORE the current bar’s open_time. This ensures no lookahead bias in ML applications.

§Feature Tiers

  • Tier 1: Core features (7) - low complexity, high value
  • Tier 2: Statistical features (5) - medium complexity
  • Tier 3: Advanced features (4) - higher complexity, from trading-fitness patterns

§Academic References

FeatureReference
OFIChordia et al. (2002) - Order imbalance
Kyle’s LambdaKyle (1985) - Continuous auctions and insider trading
BurstinessGoh & Barabási (2008) - Burstiness and memory in complex systems
Kaufman ERKaufman (1995) - Smarter Trading
Garman-KlassGarman & Klass (1980) - On the Estimation of Security Price Volatilities
Hurst (DFA)Peng et al. (1994) - Mosaic organization of DNA nucleotides
Permutation EntropyBandt & Pompe (2002) - Permutation Entropy: A Natural Complexity Measure

Structs§

InterBarConfig
Configuration for inter-bar feature computation
InterBarFeatures
Inter-bar features computed from lookback window
TradeHistory
Trade history ring buffer for inter-bar feature computation
TradeSnapshot
Lightweight snapshot of trade for history buffer

Enums§

LookbackMode
Lookback mode for trade history