#[non_exhaustive]pub struct CrossSection {
pub members: Vec<Member>,
pub timestamp: i64,
}Expand description
A market-breadth cross-section: the per-symbol state of an entire universe at a single point in time.
Invariants enforced by new:
membersis non-empty (a breadth reading needs at least one symbol).- every member’s
changeis finite, andvolumeis finite and non-negative.
timestamp is a caller-defined epoch / resolution and is not validated.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.members: Vec<Member>Per-symbol members of the universe for this tick.
timestamp: i64Tick timestamp (caller-defined epoch / resolution).
Implementations§
Source§impl CrossSection
impl CrossSection
Sourcepub fn new(members: Vec<Member>, timestamp: i64) -> Result<Self>
pub fn new(members: Vec<Member>, timestamp: i64) -> Result<Self>
Construct a cross-section, validating every member invariant.
§Errors
Returns Error::InvalidCrossSection if members is empty, if any
member has a non-finite change, or if any member has a volume that is
not a finite non-negative number.
Sourcepub const fn new_unchecked(members: Vec<Member>, timestamp: i64) -> Self
pub const fn new_unchecked(members: Vec<Member>, timestamp: i64) -> Self
Construct a cross-section without validation. The caller asserts that
every invariant documented on CrossSection holds.
Sourcepub fn advancers(&self) -> usize
pub fn advancers(&self) -> usize
Number of advancing symbols (those with a strictly positive change).
Sourcepub fn decliners(&self) -> usize
pub fn decliners(&self) -> usize
Number of declining symbols (those with a strictly negative change).
Sourcepub fn advancing_volume(&self) -> f64
pub fn advancing_volume(&self) -> f64
Total volume traded by advancing symbols (those with positive change).
Sourcepub fn declining_volume(&self) -> f64
pub fn declining_volume(&self) -> f64
Total volume traded by declining symbols (those with negative change).
Sourcepub fn total_volume(&self) -> f64
pub fn total_volume(&self) -> f64
Total volume traded across the whole universe.
Sourcepub fn above_ma_count(&self) -> usize
pub fn above_ma_count(&self) -> usize
Number of symbols trading above their reference moving average.
Sourcepub fn on_buy_signal_count(&self) -> usize
pub fn on_buy_signal_count(&self) -> usize
Number of symbols on a point-and-figure buy signal.
Trait Implementations§
Source§impl Clone for CrossSection
impl Clone for CrossSection
Source§fn clone(&self) -> CrossSection
fn clone(&self) -> CrossSection
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 CrossSection
impl Debug for CrossSection
Source§impl PartialEq for CrossSection
impl PartialEq for CrossSection
Source§fn eq(&self, other: &CrossSection) -> bool
fn eq(&self, other: &CrossSection) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CrossSection
Auto Trait Implementations§
impl Freeze for CrossSection
impl RefUnwindSafe for CrossSection
impl Send for CrossSection
impl Sync for CrossSection
impl Unpin for CrossSection
impl UnsafeUnpin for CrossSection
impl UnwindSafe for CrossSection
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
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