Skip to main content

VolumeProfile

Struct VolumeProfile 

Source
pub struct VolumeProfile { /* private fields */ }
Expand description

Volume traded at each price row of bars or host-supplied option strikes.

Implementations§

Source§

impl VolumeProfile

Source

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.

Source

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.

Source

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.

Source

pub fn source(&self) -> ProfileSource

Whether the volumes are estimated from bars, executed or option turnover.

Source

pub fn low(&self) -> f64

Bottom edge of the first row.

Source

pub fn high(&self) -> f64

Top edge of the last row.

Source

pub fn row_height(&self) -> f64

Price height of a row.

Source

pub fn volume(&self) -> &[f64]

Total volume per row, lowest price first.

Source

pub fn up(&self) -> &[f64]

Up-bar volume per row (unchanged closes count as up), or calls for options.

Source

pub fn down(&self) -> &[f64]

Down-bar volume per row, or puts for options.

Source

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.

Source

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

Source§

fn clone(&self) -> VolumeProfile

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VolumeProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for VolumeProfile

Source§

fn eq(&self, other: &VolumeProfile) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VolumeProfile

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.