nautilus_indicators/python/momentum/
amat.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16use nautilus_model::data::{Bar, QuoteTick, TradeTick};
17use pyo3::prelude::*;
18
19use crate::{
20    average::MovingAverageType, indicator::Indicator, momentum::amat::ArcherMovingAveragesTrends,
21};
22
23#[pymethods]
24impl ArcherMovingAveragesTrends {
25    #[new]
26    #[pyo3(signature = (fast_period, slow_period, signal_period, ma_type=None))]
27    #[must_use]
28    pub fn py_new(
29        fast_period: usize,
30        slow_period: usize,
31        signal_period: usize,
32        ma_type: Option<MovingAverageType>,
33    ) -> Self {
34        Self::new(fast_period, slow_period, signal_period, ma_type)
35    }
36
37    fn __repr__(&self) -> String {
38        format!(
39            "ArcherMovingAveragesTrends({},{},{},{})",
40            self.fast_period, self.slow_period, self.signal_period, self.ma_type
41        )
42    }
43
44    #[getter]
45    #[pyo3(name = "name")]
46    fn py_name(&self) -> String {
47        self.name()
48    }
49
50    #[getter]
51    #[pyo3(name = "fast_period")]
52    const fn py_fast_period(&self) -> usize {
53        self.fast_period
54    }
55
56    #[getter]
57    #[pyo3(name = "slow_period")]
58    const fn py_slow_period(&self) -> usize {
59        self.slow_period
60    }
61
62    #[getter]
63    #[pyo3(name = "signal_period")]
64    const fn py_signal_period(&self) -> usize {
65        self.signal_period
66    }
67
68    #[getter]
69    #[pyo3(name = "has_inputs")]
70    fn py_has_inputs(&self) -> bool {
71        self.has_inputs()
72    }
73
74    #[getter]
75    #[pyo3(name = "long_run")]
76    const fn py_long_run(&self) -> bool {
77        self.long_run
78    }
79
80    #[getter]
81    #[pyo3(name = "short_run")]
82    const fn py_short_run(&self) -> bool {
83        self.short_run
84    }
85
86    #[getter]
87    #[pyo3(name = "initialized")]
88    const fn py_initialized(&self) -> bool {
89        self.initialized
90    }
91
92    #[pyo3(name = "update_raw")]
93    fn py_update_raw(&mut self, close: f64) {
94        self.update_raw(close);
95    }
96
97    #[pyo3(name = "handle_quote_tick")]
98    const fn py_handle_quote_tick(&mut self, _quote: &QuoteTick) {
99        // Function body intentionally left blank.
100    }
101
102    #[pyo3(name = "handle_trade_tick")]
103    const fn py_handle_trade_tick(&mut self, _trade: &TradeTick) {
104        // Function body intentionally left blank.
105    }
106
107    #[pyo3(name = "handle_bar")]
108    fn py_handle_bar(&mut self, bar: &Bar) {
109        self.handle_bar(bar);
110    }
111
112    #[pyo3(name = "reset")]
113    fn py_reset(&mut self) {
114        self.reset();
115    }
116}