pub struct AdaptiveMovingAverage {
pub period_efficiency_ratio: usize,
pub period_fast: usize,
pub period_slow: usize,
pub price_type: PriceType,
pub value: f64,
pub count: usize,
pub initialized: bool,
/* private fields */
}Expand description
An indicator which calculates an adaptive moving average (AMA) across a rolling window. Developed by Perry Kaufman, the AMA is a moving average designed to account for market noise and volatility. The AMA will closely follow prices when the price swings are relatively small and the noise is low. The AMA will increase lag when the price swings increase.
Fields§
§period_efficiency_ratio: usizeThe period for the internal EfficiencyRatio indicator.
period_fast: usizeThe period for the fast smoothing constant (> 0).
period_slow: usizeThe period for the slow smoothing constant (> period_fast).
price_type: PriceTypeThe price type used for calculations.
value: f64The last indicator value.
count: usizeThe input count for the indicator.
initialized: boolImplementations§
Source§impl AdaptiveMovingAverage
impl AdaptiveMovingAverage
Sourcepub fn new(
period_efficiency_ratio: usize,
period_fast: usize,
period_slow: usize,
price_type: Option<PriceType>,
) -> Self
pub fn new( period_efficiency_ratio: usize, period_fast: usize, period_slow: usize, price_type: Option<PriceType>, ) -> Self
Creates a new AdaptiveMovingAverage instance.
§Panics
This function panics if:
period_efficiency_ratio== 0.period_fast== 0.period_slow== 0.period_slow≤period_fast.
pub fn alpha_diff(&self) -> f64
pub const fn reset(&mut self)
Source§impl AdaptiveMovingAverage
impl AdaptiveMovingAverage
Sourcepub fn py_new(
period_efficiency_ratio: usize,
period_fast: usize,
period_slow: usize,
price_type: Option<PriceType>,
) -> Self
pub fn py_new( period_efficiency_ratio: usize, period_fast: usize, period_slow: usize, price_type: Option<PriceType>, ) -> Self
An indicator which calculates an adaptive moving average (AMA) across a rolling window. Developed by Perry Kaufman, the AMA is a moving average designed to account for market noise and volatility. The AMA will closely follow prices when the price swings are relatively small and the noise is low. The AMA will increase lag when the price swings increase.
Trait Implementations§
Source§impl Debug for AdaptiveMovingAverage
impl Debug for AdaptiveMovingAverage
Source§impl Display for AdaptiveMovingAverage
impl Display for AdaptiveMovingAverage
Source§impl Indicator for AdaptiveMovingAverage
impl Indicator for AdaptiveMovingAverage
fn name(&self) -> String
fn has_inputs(&self) -> bool
fn initialized(&self) -> bool
fn handle_quote(&mut self, quote: &QuoteTick)
fn handle_trade(&mut self, trade: &TradeTick)
fn handle_bar(&mut self, bar: &Bar)
fn reset(&mut self)
fn handle_delta(&mut self, delta: &OrderBookDelta)
fn handle_deltas(&mut self, deltas: &OrderBookDeltas)
fn handle_depth(&mut self, depth: &OrderBookDepth10)
fn handle_book(&mut self, book: &OrderBook)
Source§impl<'py> IntoPyObject<'py> for AdaptiveMovingAverage
impl<'py> IntoPyObject<'py> for AdaptiveMovingAverage
Source§type Target = AdaptiveMovingAverage
type Target = AdaptiveMovingAverage
Source§type Output = Bound<'py, <AdaptiveMovingAverage as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <AdaptiveMovingAverage as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for AdaptiveMovingAverage
impl PyClass for AdaptiveMovingAverage
Source§impl PyClassImpl for AdaptiveMovingAverage
impl PyClassImpl for AdaptiveMovingAverage
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// An indicator which calculates an adaptive moving average (AMA) across a
/// rolling window. Developed by Perry Kaufman, the AMA is a moving average
/// designed to account for market noise and volatility. The AMA will closely
/// follow prices when the price swings are relatively small and the noise is
/// low. The AMA will increase lag when the price swings increase.
const RAW_DOC: &'static CStr = /// An indicator which calculates an adaptive moving average (AMA) across a /// rolling window. Developed by Perry Kaufman, the AMA is a moving average /// designed to account for market noise and volatility. The AMA will closely /// follow prices when the price swings are relatively small and the noise is /// low. The AMA will increase lag when the price swings increase.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<AdaptiveMovingAverage as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<AdaptiveMovingAverage>
type Layout = <<AdaptiveMovingAverage as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<AdaptiveMovingAverage>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForAdaptiveMovingAverage
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for AdaptiveMovingAverage
impl PyClassNewTextSignature for AdaptiveMovingAverage
const TEXT_SIGNATURE: &'static str = "(period_efficiency_ratio, period_fast, period_slow, price_type=None)"
Source§impl PyStubType for AdaptiveMovingAverage
impl PyStubType for AdaptiveMovingAverage
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
Source§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for AdaptiveMovingAverage
impl PyTypeInfo for AdaptiveMovingAverage
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for AdaptiveMovingAverage
impl ExtractPyClassWithClone for AdaptiveMovingAverage
Auto Trait Implementations§
impl Freeze for AdaptiveMovingAverage
impl RefUnwindSafe for AdaptiveMovingAverage
impl Send for AdaptiveMovingAverage
impl Sync for AdaptiveMovingAverage
impl Unpin for AdaptiveMovingAverage
impl UnsafeUnpin for AdaptiveMovingAverage
impl UnwindSafe for AdaptiveMovingAverage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.