pub struct RangeBar {Show 20 fields
pub open_time: i64,
pub close_time: i64,
pub open: FixedPoint,
pub high: FixedPoint,
pub low: FixedPoint,
pub close: FixedPoint,
pub volume: FixedPoint,
pub turnover: i128,
pub individual_trade_count: u32,
pub agg_record_count: u32,
pub first_trade_id: i64,
pub last_trade_id: i64,
pub data_source: DataSource,
pub buy_volume: FixedPoint,
pub sell_volume: FixedPoint,
pub buy_trade_count: u32,
pub sell_trade_count: u32,
pub vwap: FixedPoint,
pub buy_turnover: i128,
pub sell_turnover: i128,
}Expand description
Range bar with OHLCV data and market microstructure enhancements
Fields§
§open_time: i64Opening timestamp in microseconds (first trade)
close_time: i64Closing timestamp in microseconds (last trade)
open: FixedPointOpening price (first trade price)
high: FixedPointHighest price in bar
low: FixedPointLowest price in bar
close: FixedPointClosing price (breach trade price)
volume: FixedPointTotal volume
turnover: i128Total turnover (sum of price * volume)
individual_trade_count: u32Total number of individual exchange trades in this range bar Sum of individual_trade_count() from all processed AggTrade records
agg_record_count: u32Number of AggTrade records processed to create this range bar NEW: Enables tracking of aggregation efficiency
first_trade_id: i64First individual trade ID in this range bar
last_trade_id: i64Last individual trade ID in this range bar
data_source: DataSourceData source this range bar was created from
buy_volume: FixedPointVolume from buy-side trades (is_buyer_maker = false) Represents aggressive buying pressure
sell_volume: FixedPointVolume from sell-side trades (is_buyer_maker = true) Represents aggressive selling pressure
buy_trade_count: u32Number of individual buy-side trades (aggressive buying)
sell_trade_count: u32Number of individual sell-side trades (aggressive selling)
vwap: FixedPointVolume Weighted Average Price for the bar Calculated incrementally as: sum(price * volume) / sum(volume)
buy_turnover: i128Turnover from buy-side trades (buy pressure)
sell_turnover: i128Turnover from sell-side trades (sell pressure)
Implementations§
Source§impl RangeBar
impl RangeBar
Sourcepub fn aggregation_efficiency(&self) -> f64
pub fn aggregation_efficiency(&self) -> f64
Average number of individual trades per AggTrade record (aggregation efficiency)
Sourcepub fn update_with_trade(&mut self, trade: &AggTrade)
pub fn update_with_trade(&mut self, trade: &AggTrade)
Update bar with new AggTrade record (always call before checking breach) Maintains market microstructure metrics incrementally