pub struct VolumeProfile { /* private fields */ }Expand description
Volume traded at each price row of bars or host-supplied option strikes.
Implementations§
Source§impl VolumeProfile
impl VolumeProfile
Sourcepub fn from_options(data: &[OptionsVolume], row_size: f64) -> Option<Self>
pub fn from_options(data: &[OptionsVolume], row_size: f64) -> Option<Self>
Group host options turnover into rows centered on multiples of row_size.
A row at strike K includes [K - row_size/2, K + row_size/2); a boundary
goes to the higher row. Calls occupy Self::up, puts Self::down.
Duplicate strikes are summed. Empty, invalid, overflowing or unrepresentable
snapshots, including grids exceeding 10,000 rows, produce no profile.
Sourcepub fn from_bars(bars: &[Bar], config: VolumeProfileConfig) -> Option<Self>
pub fn from_bars(bars: &[Bar], config: VolumeProfileConfig) -> Option<Self>
Distribute finite, nonnegative-volume bars over their high-low ranges. Invalid bars are ignored. Returns no profile for an empty or unrepresentable grid.
Sourcepub fn from_executions(
bar: &FootprintBar,
step: f64,
tick_size: f64,
complete: bool,
) -> Option<Self>
pub fn from_executions( bar: &FootprintBar, step: f64, tick_size: f64, complete: bool, ) -> Option<Self>
Group the executions of one span into a row per traded price step, from the lowest
traded row to the highest, so untraded rows between them hold zero. step is the
footprint’s price_step, tick_size its
tick_size, and complete whether executions are held
from the start of the span. A row spans from half a tick below its first tick to half
a tick below the next row’s, so a trade at 100 with a tick of 1 spans 99.5 to 100.5.
Buys occupy Self::up and sells Self::down; unclassified volume is in
Self::volume only. Returns no profile without executed volume, or for more than
10,000 rows.
Sourcepub fn source(&self) -> ProfileSource
pub fn source(&self) -> ProfileSource
Whether the volumes are estimated from bars, executed or option turnover.
Sourcepub fn row_height(&self) -> f64
pub fn row_height(&self) -> f64
Price height of a row.
Sourcepub fn up(&self) -> &[f64]
pub fn up(&self) -> &[f64]
Up-bar volume per row (unchanged closes count as up), or calls for options.
Sourcepub fn with_bar(&self, bar: &Bar) -> Option<Self>
pub fn with_bar(&self, bar: &Bar) -> Option<Self>
Add one completed bar without redistributing earlier bars. Fixed-height grids grow
at the edges; equal-row grids return None when the bar moves a boundary.
A changed forming bar must be added to the profile before that bar, not added twice.
Sourcepub fn poc_and_value_area(&self, share: f64) -> Option<(usize, (usize, usize))>
pub fn poc_and_value_area(&self, share: f64) -> Option<(usize, (usize, usize))>
The row with the most volume (point of control), and the lowest and
highest row of the value area, which holds share of the volume;
None when no volume traded. POC ties take the lower row; value-area
ties add one row on each side.
Trait Implementations§
Source§impl Clone for VolumeProfile
impl Clone for VolumeProfile
Source§fn clone(&self) -> VolumeProfile
fn clone(&self) -> VolumeProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VolumeProfile
impl Debug for VolumeProfile
Source§impl PartialEq for VolumeProfile
impl PartialEq for VolumeProfile
impl StructuralPartialEq for VolumeProfile
Auto Trait Implementations§
impl Freeze for VolumeProfile
impl RefUnwindSafe for VolumeProfile
impl Send for VolumeProfile
impl Sync for VolumeProfile
impl Unpin for VolumeProfile
impl UnsafeUnpin for VolumeProfile
impl UnwindSafe for VolumeProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more