of_signals
of_signals contains strategy modules that transform analytics snapshots into stable directional state.
It is intentionally separated from ingestion/runtime plumbing so strategy logic remains easy to test and evolve.
Core API
- Trait: [
SignalModule] - Gate result: [
SignalGateDecision] - Built-in modules:
- [
DeltaMomentumSignal] - [
VolumeImbalanceSignal] - [
CumulativeDeltaSignal] - [
AbsorptionSignal] - [
ExhaustionSignal] - [
SweepDetectionSignal] - [
CompositeSignal]
- [
New In 0.2.0
Relative to the 0.1.x line, of_signals now includes a broader built-in
catalog:
- [
VolumeImbalanceSignal] - [
CumulativeDeltaSignal] - [
AbsorptionSignal] - [
ExhaustionSignal] - [
SweepDetectionSignal] - [
CompositeSignal]
The original trait contract stayed stable, so downstream custom modules do not need a migration.
Public API Inventory
Public types:
- [
SignalGateDecision] - [
SignalModule] - [
DeltaMomentumSignal] - [
VolumeImbalanceSignal] - [
CumulativeDeltaSignal] - [
AbsorptionSignal] - [
ExhaustionSignal] - [
SweepDetectionSignal] - [
CompositeSignal]
Public constructors:
- [
DeltaMomentumSignal::new] - [
VolumeImbalanceSignal::new] - [
CumulativeDeltaSignal::new] - [
AbsorptionSignal::new] - [
ExhaustionSignal::new] - [
SweepDetectionSignal::new] - [
CompositeSignal::new]
[SignalModule] trait methods:
on_analytics(&AnalyticsSnapshot)snapshot() -> SignalSnapshotquality_gate(DataQualityFlags) -> SignalGateDecision
Signal output uses of_core::SignalSnapshot and states such as LongBias, ShortBias, Neutral, and Blocked.
SignalModule Contract
[SignalModule] is the extension point for strategy logic.
on_analytics(&AnalyticsSnapshot)consumes the latest analytics state and updates internal signal state.snapshot()returns the last computedSignalSnapshot.quality_gate(DataQualityFlags)tells the runtime whether the signal should be blocked under the current feed-quality conditions.
Recommended implementation rules:
- keep updates deterministic so replay and live runs match
- include human-readable
reasontext in the snapshot when practical - use
confidenceconsistently so downstream hosts can compare modules - block aggressively on stale, gap, or degraded feed conditions when a strategy should not trade through uncertainty
Constructor Parameter Reference
- [
DeltaMomentumSignal::new] takes an absolutedeltathreshold. - [
VolumeImbalanceSignal::new] takes an absolute sessionbuy_volume - sell_volumethreshold. - [
CumulativeDeltaSignal::new] takes an absolutecumulative_deltathreshold. - [
AbsorptionSignal::new] takes:threshold: directional pressure required before checking for absorptionprice_band: max distance from POC/value location used by the heuristic
- [
ExhaustionSignal::new] takes an absolute delta threshold for stalled reversal detection. - [
SweepDetectionSignal::new] takes:threshold: directional delta thresholdbreakout_ticks: minimum break outside value area
- [
CompositeSignal::new] takes owned child modules and aggregates their votes.
Delta Momentum Strategy
[DeltaMomentumSignal] is a reference implementation that:
- emits
LongBiaswhendelta >= threshold - emits
ShortBiaswhendelta <= -threshold - emits
Neutralotherwise - emits
Blockedin runtime when quality gate fails
Volume Imbalance Strategy
[VolumeImbalanceSignal] is a reference implementation that:
- compares session
buy_volume - sell_volumeagainst an absolute threshold - emits
LongBiaswhen buy pressure dominates - emits
ShortBiaswhen sell pressure dominates - remains
Neutralwhile the session imbalance stays inside the configured band
Cumulative Delta Strategy
[CumulativeDeltaSignal] is a session-bias module that:
- compares
cumulative_deltaagainst an absolute threshold - emits
LongBiaswhen session delta remains strongly positive - emits
ShortBiaswhen session delta remains strongly negative - remains
Neutralwhile cumulative delta stays inside the configured band
Absorption Strategy
[AbsorptionSignal] is a heuristic module that:
- looks for strong directional delta that fails to move price away from POC
- emits
LongBiason sell absorption near POC - emits
ShortBiason buy absorption near POC
Exhaustion Strategy
[ExhaustionSignal] is a heuristic reversal module that:
- looks for strong directional delta that stalls back near POC
- emits
ShortBiaswhen buying appears exhausted - emits
LongBiaswhen selling appears exhausted
Sweep Detection Strategy
[SweepDetectionSignal] is a breakout module that:
- looks for strong delta alongside a break outside value area
- emits
LongBiason upside sweeps - emits
ShortBiason downside sweeps
Composite Strategy
[CompositeSignal] combines multiple child modules and:
- updates each child on the same analytics snapshot
- emits the majority directional view when one side has more votes
- remains
Neutralwhen there is no directional majority
Output Interpretation
All built-in modules return SignalSnapshot, which downstream runtimes and bindings expose unchanged.
stateis the durable directional stateconfidenceis a normalized score chosen by the modulereasonis short human-readable rationalequality_flagsechoes the quality context that contributed to blocking or caution
Built-in modules are intentionally heuristic rather than venue-specific alpha models. They are meant as production-ready references and defaults, not as the only strategy approach.
Quick Example
use ;
use ;
let mut signal = new;
signal.on_analytics;
let snapshot = signal.snapshot;
assert!;
Alternative Module Example
use ;
use ;
let mut signal = new;
signal.on_analytics;
let snapshot = signal.snapshot;
assert!;
Composite Example
use ;
use ;
let mut signal = new;
signal.on_analytics;
let snapshot = signal.snapshot;
assert!;
Quality Gate Example
use DataQualityFlags;
use ;
let signal = default;
let gate = signal.quality_gate;
assert_eq!;
Implementing Your Own Signal Module
Implement [SignalModule] and keep it:
- deterministic (important for replay parity)
- explicit about confidence and reason fields
- strict about quality gating for unsafe feed states
- compatible with the stable
SignalSnapshotcontract so bindings and FFI callers keep working
Real-World Use Cases
1. Gate entries on feed quality
Even a simple threshold signal becomes materially safer when quality_gate(...)
blocks action during stale, gap, or degraded feed states.
2. Build multi-factor orderflow strategies
Use several modules together to express:
- context:
CumulativeDeltaSignal - trigger:
SweepDetectionSignal - reversal filter:
AbsorptionSignalorExhaustionSignal
3. Keep strategy logic deterministic in replay
Because modules consume normalized analytics instead of live provider payloads, the same module can be replayed over historical sessions and compared to live behavior with much less drift.
Strategy Pattern: Composite Confirmation
A practical strategy stack often looks like:
CumulativeDeltaSignalfor directional regime biasVolumeImbalanceSignalfor immediate orderflow pressureSweepDetectionSignalfor breakout confirmationCompositeSignalto require majority confirmation
Detailed Example: Build A Composite Intraday Bias Module
use ;
use ;
Detailed Example: Write Your Own Signal Module
use ;
use ;