Skip to main content

PersistentVolumeProfileEngine

Struct PersistentVolumeProfileEngine 

Source
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

Source

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.

Source

pub fn with_absorption_k(self, k: f64) -> Self

Source

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

Source§

fn name(&self) -> &str

Source§

fn warmup_period(&self) -> usize

Source§

fn reset(&mut self)

Source§

fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>

Source§

fn alerts(&self) -> Vec<IndicatorAlert>

Source§

fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>

Validates a bar before forwarding it to Indicator::on_bar.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.