pub trait IndicatorInstanceDyn<T: OHLCV> {
    fn next(&mut self, candle: &T) -> IndicatorResult;
    fn over(&mut self, inputs: &dyn AsRef<[T]>) -> Vec<IndicatorResult>;
    fn config(&self) -> &dyn IndicatorConfigDyn<T>;
    fn size(&self) -> (u8, u8);
    fn name(&self) -> &'static str;
}
Expand description

Dynamically dispatchable IndicatorInstance

Required methods

Evaluates given candle and returns IndicatorResult

Evaluates the State over the given sequence of candles and returns sequence of IndicatorResults.

use yata::prelude::dd::*;
use yata::helpers::{RandomCandles};
use yata::indicators::Trix;

let candles: Vec<_> = RandomCandles::new().take(10).collect();
let static_config = Trix::default();
let dyn_config: Box<dyn IndicatorConfigDyn<_>> = Box::new(static_config); // here we are loosing information about `IndicatorConfig`s type.
let mut state = dyn_config.init(&candles[0]).unwrap();

let results = state.over(&candles);
println!("{:?}", results);

Returns a reference to dynamically dispatched Configuration, associated with the current State

Returns count of indicator’s raw values and count of indicator’s signals.

See more at IndicatorConfig

Returns a name of the indicator

Implementors