Trait yata::core::IndicatorInstance
source · [−]pub trait IndicatorInstance: Sized {
type Config: IndicatorConfig<Instance = Self>;
fn config(&self) -> &Self::Config;
fn next<T: OHLCV>(&mut self, candle: &T) -> IndicatorResult;
fn over<T, S>(&mut self, inputs: S) -> Vec<IndicatorResult>
where
T: OHLCV,
S: AsRef<[T]>,
{ ... }
fn size(&self) -> (u8, u8) { ... }
fn name(&self) -> &'static str { ... }
fn into_fn<'a, T>(self) -> Box<dyn FnMut(&'a T) -> IndicatorResult>
where
T: OHLCV,
Self: 'static,
{ ... }
}
Expand description
Base trait for implementing indicators State
Associated Types
type Config: IndicatorConfig<Instance = Self>
type Config: IndicatorConfig<Instance = Self>
Type of Indicator Configuration
Required methods
fn next<T: OHLCV>(&mut self, candle: &T) -> IndicatorResult
fn next<T: OHLCV>(&mut self, candle: &T) -> IndicatorResult
Evaluates given candle and returns IndicatorResult
Provided methods
Evaluates the State over the given sequence of candles and returns sequence of IndicatorResult
s.
use yata::prelude::*;
use yata::helpers::{RandomCandles};
use yata::indicators::Trix;
let candles: Vec<_> = RandomCandles::new().take(10).collect();
let trix = Trix::default();
let mut state = trix.init(&candles[0]).unwrap();
let results = state.over(&candles);
println!("{:?}", results);
Returns count of indicator’s raw values and count of indicator’s signals.
See more at IndicatorConfig
Implementors
sourceimpl IndicatorInstance for ExampleInstance
impl IndicatorInstance for ExampleInstance
Implementing IndicatorInstance
trait for Example