use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
#[allow(dead_code)]
pub enum IndicatorType {
Sma,
Ema,
Wma,
Dema,
Tema,
Rsi,
Macd,
Adx,
WilliamsR,
Bollinger,
Stochastic,
}
impl IndicatorType {
#[allow(dead_code)]
pub fn as_str(&self) -> &'static str {
match self {
Self::Sma => "SMA",
Self::Ema => "EMA",
Self::Wma => "WMA",
Self::Dema => "DEMA",
Self::Tema => "TEMA",
Self::Rsi => "RSI",
Self::Macd => "MACD",
Self::Adx => "ADX",
Self::WilliamsR => "Williams %R",
Self::Bollinger => "Bollinger Bands",
Self::Stochastic => "Stochastic",
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
#[allow(dead_code)]
pub struct IndicatorValue {
pub date: String,
pub value: Option<f64>,
pub signal: Option<f64>,
pub histogram: Option<f64>,
pub upper_band: Option<f64>,
pub lower_band: Option<f64>,
}