pub struct PersistentVolumeProfileEngine { /* private fields */ }Expand description
Persistent volume profile over the last lookback bars on a fixed price grid.
A bin is [k * bin_width, (k + 1) * bin_width) with k = floor(price / bin_width). Each bar’s
volume — its range when it carries no volume — is spread evenly over the bins from its low’s
key to its high’s key; when the bar leaves the window exactly that contribution is taken back,
and a bin with no touches or no volume left is removed. value is the POC: the centre of the
first (lowest-priced) live bin with the largest volume. The profile and a per-bin absorption
profile come as ProfileArtifacts; bins whose volume per touch is a robust outlier (median
plus absorption_k scaled MAD, 2.5 by default) additionally as ZoneArtifacts.
First output: with the lookback-th bar. Indicator::reset clears bins and window.
Implementations§
Source§impl PersistentVolumeProfileEngine
impl PersistentVolumeProfileEngine
Sourcepub fn new(lookback: usize, bin_width: f64) -> Self
pub fn new(lookback: usize, bin_width: f64) -> Self
bin_width is a fixed price-grid resolution (not derived from the rolling window’s
min/max), the mechanism that gives bins a stable identity across updates.
pub fn with_absorption_k(self, k: f64) -> Self
Sourcepub fn absorption_profile(&self) -> Vec<AbsorptionBin>
pub fn absorption_profile(&self) -> Vec<AbsorptionBin>
Per-bin absorption view: a bin is flagged when its volume-per-touch is a robust outlier
(median + absorption_k scaled-MAD) across the currently live bins — a small number of
bars depositing disproportionate volume at one price level without it rolling away.
Trait Implementations§
Source§impl Indicator for PersistentVolumeProfileEngine
impl Indicator for PersistentVolumeProfileEngine
fn name(&self) -> &str
fn warmup_period(&self) -> usize
fn reset(&mut self)
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
fn alerts(&self) -> Vec<IndicatorAlert>
Source§fn on_checked_bar(
&mut self,
bar: &Bar,
) -> Result<Option<IndicatorOutput>, BarValidationError>
fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>
Indicator::on_bar.