528e8f33d6
k · sqrt(EMA(delta^2, length)) over completed period_minutes buckets — the vol regime on a coarser clock, as a fused primitive in the Resample mold: the in-progress bucket lives in node state, the finished bucket's close is differenced against the previous one on rollover, and the stop distance is emitted ONCE per completed bucket (C2: a partial bucket never exists downstream; Firing::Any consumers hold the last value). EMA follows Ema's exact convention (SMA seed over the first length deltas, alpha = 2/(length+1)), pinned by a constant-|delta| correspondence test against the per-cycle vol regime. Not rostered in the std vocabulary (stop primitives are risk-executor internals). First slice of #262; the regime variants, executor arm, and manifest round-trip follow. refs #262
102 lines
2.7 KiB
Rust
102 lines
2.7 KiB
Rust
//! `aura-std` — the standard node library shipped with the engine.
|
|
//!
|
|
//! The universal, batteries-included building blocks every project gets for
|
|
//! free: common indicators (SMA, ATR, RSI, …), resamplers, the `SessionNode`,
|
|
//! standard combinators, the legacy `SimBroker` pip yardstick, and cost-model
|
|
//! nodes authored against the [`CostNode`] trait + [`CostRunner`] adapter
|
|
//! (`ConstantCost`, `VolSlippageCost`, …, in R — C10). Depends only on `aura-core`
|
|
//! (the shared contract).
|
|
//!
|
|
//! This is the top tier of the three-tier node-reuse model (contract C16):
|
|
//!
|
|
//! - `aura-std` — universal blocks, here, ship with the engine;
|
|
//! - shared node crates — cross-project-reusable blocks, in their own repos,
|
|
//! pulled in as cargo git dependencies;
|
|
//! - project-local `nodes/` — experimental, project-specific blocks.
|
|
//!
|
|
//! The first block lands with the walking skeleton: [`Sma`], the simple moving
|
|
//! average — a worked producer node proving the `aura-core` `Node` contract.
|
|
|
|
mod abs;
|
|
mod add;
|
|
mod and;
|
|
mod bias;
|
|
mod carry_cost;
|
|
mod const_node;
|
|
mod constant_cost;
|
|
mod cost;
|
|
mod cost_sum;
|
|
mod delay;
|
|
mod div;
|
|
mod ema;
|
|
mod eqconst;
|
|
mod gated_recorder;
|
|
mod gt;
|
|
mod latch;
|
|
mod lincomb;
|
|
mod longonly;
|
|
mod max;
|
|
mod min;
|
|
mod mul;
|
|
mod position_management;
|
|
mod recorder;
|
|
mod resample;
|
|
mod rolling_max;
|
|
mod rolling_min;
|
|
mod scale;
|
|
mod series_reducer;
|
|
mod session;
|
|
mod sim_broker;
|
|
mod sizer;
|
|
mod sma;
|
|
mod sqrt;
|
|
mod stop_rule;
|
|
mod sub;
|
|
mod vocabulary;
|
|
mod vol_slippage_cost;
|
|
mod vol_tf_stop;
|
|
pub use abs::Abs;
|
|
pub use add::Add;
|
|
pub use and::And;
|
|
pub use bias::Bias;
|
|
pub use carry_cost::CarryCost;
|
|
pub use const_node::Const;
|
|
pub use constant_cost::ConstantCost;
|
|
pub use cost::{
|
|
cost_node_builder, cost_port, intern_port, ChargeMode, CostNode, CostRunner,
|
|
COST_FIELD_NAMES, COST_WIDTH, GEOMETRY_WIDTH,
|
|
};
|
|
pub use cost_sum::CostSum;
|
|
pub use delay::Delay;
|
|
pub use div::Div;
|
|
pub use ema::Ema;
|
|
pub use eqconst::EqConst;
|
|
pub use gated_recorder::GatedRecorder;
|
|
pub use gt::Gt;
|
|
pub use latch::Latch;
|
|
pub use lincomb::LinComb;
|
|
pub use longonly::LongOnly;
|
|
pub use max::Max;
|
|
pub use min::Min;
|
|
pub use mul::Mul;
|
|
pub use position_management::{
|
|
ExitReason, FIELD_NAMES as PM_FIELD_NAMES, PositionManagement, RECORD_KINDS as PM_RECORD_KINDS,
|
|
WIDTH as PM_WIDTH,
|
|
};
|
|
pub use recorder::Recorder;
|
|
pub use resample::Resample;
|
|
pub use rolling_max::RollingMax;
|
|
pub use rolling_min::RollingMin;
|
|
pub use scale::Scale;
|
|
pub use series_reducer::SeriesReducer;
|
|
pub use session::{Session, SessionFrankfurt};
|
|
pub use sim_broker::SimBroker;
|
|
pub use sizer::Sizer;
|
|
pub use sma::Sma;
|
|
pub use sqrt::Sqrt;
|
|
pub use stop_rule::FixedStop;
|
|
pub use sub::Sub;
|
|
pub use vocabulary::{std_vocabulary, std_vocabulary_types};
|
|
pub use vol_slippage_cost::VolSlippageCost;
|
|
pub use vol_tf_stop::VolTfStop;
|