quant-indicators 0.7.0

Pure indicator math library for trading — MA, RSI, Bollinger, MACD, ATR, HRP
Documentation
#![cfg_attr(
    test,
    allow(
        clippy::expect_used,
        clippy::unwrap_used,
        clippy::panic,
        clippy::indexing_slicing
    )
)]

//! Pure indicator math library for trading.
//!
//! All functions are pure math - no I/O, no async, WASM-compatible.
//!
//! # Example
//!
//! ```
//! use quant_indicators::{Indicator, Sma, Ema};
//! use quant_primitives::Candle;
//! use chrono::Utc;
//! use rust_decimal_macros::dec;
//!
//! let ts = Utc::now();
//! let candles: Vec<Candle> = (0..20).map(|i| {
//!     Candle::new(dec!(100), dec!(110), dec!(90), dec!(100) + rust_decimal::Decimal::from(i), dec!(1000), ts).unwrap()
//! }).collect();
//! let sma = Sma::new(20).unwrap();
//! let series = sma.compute(&candles).unwrap();
//!
//! // Indicators are composable
//! let ema = Ema::new(20).unwrap();
//! let ema_series = ema.compute(&candles).unwrap();
//! ```

mod test_helpers;

mod atr;
mod bollinger;
mod close;
mod combinators;
mod detrended;
mod efficiency_ratio;
mod ema;
mod error;
pub mod hrp;
mod hull;
mod hurst;
mod indicator;
mod kalman;
mod ma;
mod ma_type;
mod macd;
mod momentum;
mod ratio_candles;
mod rolling_zscore;
mod rsi;
mod series;
mod sma;
mod stddev;
mod supertrend;
mod variance_ratio;
mod volume_signal;
mod wma;

pub use atr::{rolling_atr_mean, true_range, Atr};
pub use bollinger::{BollingerBands, BollingerResult};
pub use close::Close;
pub use combinators::{Diff, Lag, Ratio, Scale};
pub use detrended::DetrendedOscillator;
pub use efficiency_ratio::EfficiencyRatio;
pub use ema::Ema;
pub use error::IndicatorError;
pub use hull::HullMa;
pub use hurst::{compute_log_returns, estimate_slope, rescaled_range_for_n, HurstExponent};
pub use indicator::{ClassificationIndicator, Indicator};
pub use kalman::{KalmanFilter, KalmanResult};
pub use ma::Ma;
pub use ma_type::MaType;
pub use macd::Macd;
pub use momentum::Momentum;
pub use ratio_candles::{ratio_close_series, synthesize_ratio_candles, RatioCandleError};
pub use rolling_zscore::RollingZScore;
pub use rsi::Rsi;
pub use series::Series;
pub use sma::Sma;
pub use stddev::StdDev;
pub use supertrend::Supertrend;
pub use variance_ratio::VarianceRatio;
pub use volume_signal::{VolSignalConfig, VolumeAnomaly, VolumeSignal, VolumeSignalIndicator};
pub use wma::Wma;