Trait yata::core::IndicatorInstance
source · pub trait IndicatorInstance: Sized {
type Config: IndicatorConfig<Instance = Self>;
// Required methods
fn config(&self) -> &Self::Config;
fn next<T: OHLCV>(&mut self, candle: &T) -> IndicatorResult;
// Provided methods
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
Required Associated Types§
sourcetype Config: IndicatorConfig<Instance = Self>
type Config: IndicatorConfig<Instance = Self>
Type of Indicator Configuration
Required Methods§
sourcefn 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§
sourcefn over<T, S>(&mut self, inputs: S) -> Vec<IndicatorResult>
fn over<T, S>(&mut self, inputs: S) -> Vec<IndicatorResult>
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);
sourcefn size(&self) -> (u8, u8)
fn size(&self) -> (u8, u8)
Returns count of indicator’s raw values and count of indicator’s signals.
See more at IndicatorConfig
Object Safety§
This trait is not object safe.
Implementors§
source§impl IndicatorInstance for ExampleInstance
impl IndicatorInstance for ExampleInstance
Implementing IndicatorInstance
trait for Example