financial_indicators 1.0.0

A Rust library providing a comprehensive suite of financial technical indicators for cryptocurrency and stock analysis. Includes trend, momentum, volatility, volume, and other common indicators such as: - MA (Moving Average) - EMA (Exponential Moving Average) - MACD (Moving Average Convergence Divergence) - DMI/ADX (Directional Movement Index / Average Directional Index) - TRIX (Triple Exponential Average) - RSI (Relative Strength Index) - ROC (Rate of Change) - CCI (Commodity Channel Index) - Stochastic Oscillator (KDJ) - MOM (Momentum) - ATR (Average True Range) - Bollinger Bands - STD (Standard Deviation) - OBV (On-Balance Volume) - VOL (Volume) - MFI (Money Flow Index) - VWAP (Volume Weighted Average Price) - SAR (Parabolic SAR) - PSY (Psychological Line) - Williams %R - CR (Cumulative Resistance)
Documentation
//! VOL (Volume) Indicator
//!
//! This module will provide a function to return the volume series as an indicator.
//!
//! # Examples
//!
//! ```
//! // Example usage will be added after implementation
//! ```

/// Returns the volume series as an indicator.
///
/// # Arguments
/// * `volume` - A slice of f64 volume values.
///
/// # Example
/// ```
/// use financial_indicators::vol::volume_indicator;
/// let volume = vec![1000.0, 1200.0, 1100.0, 1300.0, 900.0];
/// let vol = volume_indicator(&volume);
/// assert_eq!(vol, volume);
/// ```
pub fn volume_indicator(volume: &[f64]) -> Vec<f64> {
    volume.to_vec()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_volume_indicator_basic() {
        let volume = vec![1000.0, 1200.0, 1100.0, 1300.0, 900.0];
        let vol = volume_indicator(&volume);
        assert_eq!(vol, volume);
    }

    #[test]
    fn test_volume_indicator_empty() {
        let volume: Vec<f64> = vec![];
        let vol = volume_indicator(&volume);
        assert_eq!(vol, vec![]);
    }
}