Struct yata::core::IndicatorResult

source ·
pub struct IndicatorResult { /* private fields */ }
Expand description

Every Indicator proceed an input of OHLCV and returns an IndicatorResult which consist of some returned raw values and some calculated signals.

Indicator may return up to 4 signals and 4 raw values at each step

Implementations§

source§

impl IndicatorResult

source

pub const SIZE: usize = 4usize

Size of pre-allocated result array For the most of cases it should not be used anywhere outside this crate

source

pub fn signals(&self) -> &[Action]

Returns a slice of signals of current indicator result

source

pub fn values(&self) -> &[ValueType]

Returns a slice of raw indicator values of current indicator result

source

pub const fn signals_length(&self) -> u8

Returns count of signals

source

pub const fn values_length(&self) -> u8

Returns count of raw values

source

pub const fn size(&self) -> (u8, u8)

Returns a tuple of count of raw values and count of signals

source

pub fn value(&self, index: usize) -> ValueType

Returns a raw value at given index

§Panics

If index is greater than last signal index, then panics

source

pub fn signal(&self, index: usize) -> Action

Returns a signal at given index

§Panics

If index is greater than last signal index, then panics

source

pub fn new(values_slice: &[ValueType], signals_slice: &[Action]) -> Self

Creates a new instance of IndicatorResult with provided values and signals

Trait Implementations§

source§

impl Clone for IndicatorResult

source§

fn clone(&self) -> IndicatorResult

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for IndicatorResult

source§

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

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

impl<'de> Deserialize<'de> for IndicatorResult

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for IndicatorResult

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for IndicatorResult

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,