Skip to main content

Module normalize

Module normalize 

Source
Expand description

Normalization functions for intra-bar ITH metrics.

Issue #59: Intra-bar microstructure features for large open deviation bars.

ORIGIN: trading-fitness/packages/metrics-rust/src/ith_normalize.rs COPIED: 2026-02-02 MODIFICATIONS: Extracted only the functions needed for intra-bar features

All outputs are bounded to [0, 1] for LSTM/BiLSTM consumption.

Issue #96 Task #197: Uses precomputed lookup tables for sigmoid and tanh to replace expensive transcendental function calls (~100-200 CPU cycles each).

Functionsยง

logistic_sigmoid
Logistic sigmoid function: 1 / (1 + exp(-(x - center) * scale))
normalize_cv
Normalize coefficient of variation (CV) to [0, 1] using logistic sigmoid.
normalize_drawdown
Normalize max drawdown to [0, 1].
normalize_epochs
Normalize epoch count to [0, 1] using rank-based transform.
normalize_excess
Normalize excess gain/loss to [0, 1] using precomputed tanh lookup table.
normalize_runup
Normalize max runup to [0, 1].