pub struct Footprint { /* private fields */ }Expand description
Trade aggregation for one instrument, shared by footprints and delta studies.
Build once for historical trades and call push for live executions.
Trades must be chronological, with exchange order preserved for equal timestamps, so
delta highs and lows are exact. Replay corrections by rebuilding, rather than silently
approximating their intrabar path. The host deduplicates ids (the chart’s feed already does).
Implementations§
Source§impl Footprint
impl Footprint
Sourcepub fn new(
clock: BarClock,
tick_size: f64,
ticks_per_row: u32,
) -> Result<Self, FeedError>
pub fn new( clock: BarClock, tick_size: f64, ticks_per_row: u32, ) -> Result<Self, FeedError>
Creates an empty aggregation. tick_size must be finite and positive, and
ticks_per_row nonzero. Prices round to the nearest integer tick, then group
downwards, including negative prices. Grouping never changes trade-side totals.
Sourcepub fn complete_from(&self) -> Option<DateTime<Utc>>
pub fn complete_from(&self) -> Option<DateTime<Utc>>
Open of the oldest bar whose executions are all held: earlier bars were cut by the budget or by trades dropped from the host’s store, or may lack trades that never arrived, and must not be shown as complete.
Sourcepub fn set_size_filter(&mut self, min: f64, max: f64) -> Result<(), FeedError>
pub fn set_size_filter(&mut self, min: f64, max: f64) -> Result<(), FeedError>
Restricts executions to this inclusive size range, before aggregation. Must be called before adding trades. Invalid ranges return an error without changing it.
Sourcepub fn price_step(&self) -> f64
pub fn price_step(&self) -> f64
Height of one grouped price row.
Sourcepub fn level_of(&self, price: f64) -> Option<i64>
pub fn level_of(&self, price: f64) -> Option<i64>
The level a trade at price falls in: the nearest tick, grouped downwards. None when
the price is not finite or the level overflows.
Sourcepub fn bars(&self) -> &BTreeMap<DateTime<Utc>, FootprintBar>
pub fn bars(&self) -> &BTreeMap<DateTime<Utc>, FootprintBar>
Aggregated bars in chronological order.
Sourcepub fn bar_at(&self, time: DateTime<Utc>) -> Option<&FootprintBar>
pub fn bar_at(&self, time: DateTime<Utc>) -> Option<&FootprintBar>
The aggregated bar containing time, using the same UTC slots as trade aggregation.
Accepts a bar stamped anywhere inside its slot, as the feed history contract does.
Sourcepub fn profile(&self, first: DateTime<Utc>, last: DateTime<Utc>) -> FootprintBar
pub fn profile(&self, first: DateTime<Utc>, last: DateTime<Utc>) -> FootprintBar
The executions of the bars that contain first through last, inclusive, as one bar
opening with the first of them: the exact profile of a span of the chart. Bars before
complete_from are left out, as their executions are not all
held. Empty when no complete bar traded there or last precedes first.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Footprint
impl RefUnwindSafe for Footprint
impl Send for Footprint
impl Sync for Footprint
impl Unpin for Footprint
impl UnsafeUnpin for Footprint
impl UnwindSafe for Footprint
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