Trait yata::core::MovingAverageConstructor
source · pub trait MovingAverageConstructor: Clone + FromStr {
type Type: Eq;
type Instance: MovingAverage;
// Required methods
fn init(&self, initial_value: ValueType) -> Result<Self::Instance, Error>;
fn ma_period(&self) -> PeriodType;
fn ma_type(&self) -> Self::Type;
// Provided method
fn is_similar_to(&self, other: &Self) -> bool { ... }
}
Expand description
Trait for dynamically creation of moving average instances based on it’s type and period
This trait plays the same role for moving averages as IndicatorConfig
plays for indicators.
Required Associated Types§
sourcetype Instance: MovingAverage
type Instance: MovingAverage
MovingAverage
Instance type
Required Methods§
sourcefn init(&self, initial_value: ValueType) -> Result<Self::Instance, Error>
fn init(&self, initial_value: ValueType) -> Result<Self::Instance, Error>
Creates moving average instance with the initial_value
sourcefn ma_period(&self) -> PeriodType
fn ma_period(&self) -> PeriodType
Returns period length of
Provided Methods§
sourcefn is_similar_to(&self, other: &Self) -> bool
fn is_similar_to(&self, other: &Self) -> bool
Checks two moving average constructors for the same moving average type
Object Safety§
This trait is not object safe.