Skip to main content

SeriesEvents

Struct SeriesEvents 

Source
pub struct SeriesEvents;
Expand description

Helper functions for time series calculations and crossovers.

Implementations§

Source§

impl SeriesEvents

Source

pub fn change(series: &Series<f64>) -> Option<f64>

Returns difference series[0] - series[1].

Source

pub fn rising(series: &Series<f64>, length: usize) -> bool

Returns true if the series has been strictly increasing over the last length bars.

Source

pub fn falling(series: &Series<f64>, length: usize) -> bool

Returns true if the series has been strictly decreasing over the last length bars.

Source

pub fn cross(a: &Series<f64>, b: &Series<f64>) -> bool

Returns true if series a crossed series b in either direction on the latest bar.

Source

pub fn crossover(a: &Series<f64>, b: &Series<f64>) -> bool

Returns true if series a crossed above series b (a[1] <= b[1] and a[0] > b[0]).

Source

pub fn crossunder(a: &Series<f64>, b: &Series<f64>) -> bool

Returns true if series a crossed below series b (a[1] >= b[1] and a[0] < b[0]).

Source

pub fn cum(series: &Series<f64>) -> f64

Returns the sum of all finite values in series.

Source

pub fn value_when<'a, T>( condition: &Series<bool>, source: &'a Series<T>, occurrence: usize, ) -> Option<&'a T>

Returns the source value at the requested occurrence of a separate condition series.

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.