audit: trio tidy — hoist the ns-per-minute constant
Cycle-close audit over the feature trio 75bfb93..d1b3a3d (#261 #260 #262). Architect verdict: clean — C1 (both stop variants and the per-instrument cost round-trip through the manifest), C2 (rollover-only emission), C18 (scalar cost wire form byte-identical; VolTf additive), the four-scalar discipline (SessionFrankfurt bakes the timezone, no string kind), and the match-arm lockstep across all four RiskRegime/ StopRule sites all hold; commit bodies match the diff. One low drift item — the repeated 60·10^9 ns-per-minute literal in vol_tf_stop.rs — fixed here as NS_PER_MINUTE rather than carried. No regression scripts are configured (the architect is the sole gate); full workspace suite green, clippy clean. Spec and plan working files discarded per the audit lifecycle. refs #262
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user