B7: give Python ROC and TRIX constructor defaults

Every other Python momentum indicator (RSI, CCI, ...) carries a
#[pyo3(signature)] default, but ROC and TRIX required an explicit
period. Both now default to the TA-Lib convention (ROC period=10, TRIX
period=30), and the .pyi stubs reflect the defaults. Node and WASM
constructors deliberately stay explicit-only -- napi-rs and
wasm-bindgen do not support default arguments, and every constructor in
those bindings is uniformly explicit.
This commit is contained in:
kingchenc
2026-05-22 04:06:18 +02:00
parent 8192e576cf
commit 4a9d27fb52
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -836,6 +836,7 @@ struct PyRoc {
#[pymethods]
impl PyRoc {
#[new]
#[pyo3(signature = (period=10))]
fn new(period: usize) -> PyResult<Self> {
Ok(Self {
inner: wc::Roc::new(period).map_err(map_err)?,
@@ -1054,6 +1055,7 @@ struct PyTrix {
#[pymethods]
impl PyTrix {
#[new]
#[pyo3(signature = (period=30))]
fn new(period: usize) -> PyResult<Self> {
Ok(Self {
inner: wc::Trix::new(period).map_err(map_err)?,