diff --git a/crates/aura-std/src/vol_tf_stop.rs b/crates/aura-std/src/vol_tf_stop.rs index 65fe825..31a5134 100644 --- a/crates/aura-std/src/vol_tf_stop.rs +++ b/crates/aura-std/src/vol_tf_stop.rs @@ -9,6 +9,9 @@ //! nothing, so the `Firing::Any` consumers (`Sizer`, `PositionManagement`) //! hold the last completed bucket's value; the R-latch samples at entry. +/// Nanoseconds per minute — the bucket-id divisor's one scale factor. +const NS_PER_MINUTE: i64 = 60 * 1_000_000_000; + use aura_core::{ Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, ParamSpec, PortSpec, PrimitiveBuilder, ScalarKind, @@ -38,7 +41,7 @@ impl VolTfStop { assert!(length >= 1, "VolTfStop length must be >= 1"); assert!(k > 0.0, "VolTfStop k must be > 0"); Self { - period_ns: period_minutes * 60 * 1_000_000_000, + period_ns: period_minutes * NS_PER_MINUTE, k, alpha: 2.0 / (length as f64 + 1.0), length: length as usize, @@ -133,7 +136,7 @@ impl Node for VolTfStop { fn label(&self) -> String { format!( "VolTfStop({}m,{},{})", - self.period_ns / (60 * 1_000_000_000), + self.period_ns / NS_PER_MINUTE, self.length, self.k ) @@ -155,7 +158,7 @@ mod tests { .iter() .map(|&(ts_min, price)| { col[0].push(Scalar::f64(price)).unwrap(); - node.eval(Ctx::new(&col, Timestamp(ts_min * 60 * 1_000_000_000))) + node.eval(Ctx::new(&col, Timestamp(ts_min * NS_PER_MINUTE))) .map(|c| c[0].f64()) }) .collect()