mylittleindicators 0.1.8

Multi-stream financial indicators library — 556 bar indicators + 21 event primitives across 35 categories. Consumes 27 stream kinds from digdigdig3 exchange connectors: OHLCV bars, ticks, orderbook (snapshot/delta/L3), funding/predicted funding/funding settlement, mark price, index price, open interest, liquidations, ticker, agg trades, long/short ratio, option greeks, volatility index, historical volatility, basis (derived), composite index, settlement events, block trades, insurance fund, risk limit, market warning, and three kline-family variants. Live-verified on 12 exchanges (89% pass-rate on a 150s BTC slice).
Documentation
//! Direction + BarConfirmation — signal direction and bar confirmation status.

use serde::{Deserialize, Serialize};

/// Направление сигнала.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Direction {
    /// Бычье — вверх.
    Up,
    /// Медвежье — вниз.
    Down,
    /// Без направления (Doji, объёмный spike, сжатие канала).
    Neutral,
}

impl Direction {
    pub fn as_i8(self) -> i8 {
        match self {
            Self::Up => 1,
            Self::Down => -1,
            Self::Neutral => 0,
        }
    }

    pub fn from_i8(v: i8) -> Self {
        match v {
            1 => Self::Up,
            -1 => Self::Down,
            _ => Self::Neutral,
        }
    }

    pub fn opposite(self) -> Self {
        match self {
            Self::Up => Self::Down,
            Self::Down => Self::Up,
            Self::Neutral => Self::Neutral,
        }
    }
}

/// Статус подтверждения бара в момент эмиссии сигнала.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BarConfirmation {
    /// Бар ещё не закрыт — сигнал может исчезнуть.
    Pending,
    /// Бар закрылся, тело подтвердило пересечение.
    Closed,
    /// Бар закрылся, но тело не подтвердило — только прокол тенью.
    WickOnly,
}