use pulse_macros::pwp; use crate::{ PulseWire, units::{Symbol, USD}, }; #[pwp] pub enum MarketTrend { Bullish, Bearish, Neutral, } #[pwp] pub enum Volatility { Low, Medium, High, } #[pwp] pub enum Direction { Buy, Sell, } #[pwp] pub struct Signal { pub symbol: String, pub kind: Direction, pub confidence: f32, pub size: f64, pub price: USD, pub take_profit: USD, pub stop_loss: USD, } #[pwp] pub enum LogKind { Info, Warn, Err, Debug, } #[pwp] pub struct EventLog { pub kind: LogKind, pub name: String, pub message: String, } #[pwp] pub struct Position { pub symbol: Symbol, pub size: f64, pub entry_price: USD, pub profit: USD, } impl std::fmt::Display for Direction { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Buy => write!(f, "BUY"), Self::Sell => write!(f, "SELL"), } } } impl std::fmt::Display for MarketTrend { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Bullish => write!(f, "Bullish"), Self::Bearish => write!(f, "Bearish"), Self::Neutral => write!(f, "Neutral"), } } } impl std::fmt::Display for Volatility { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Low => write!(f, "Low"), Self::Medium => write!(f, "Medium"), Self::High => write!(f, "High"), } } } impl std::fmt::Display for LogKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Info => write!(f, "INFO"), Self::Warn => write!(f, "WARN"), Self::Err => write!(f, "ERR"), Self::Debug => write!(f, "DEBUG"), } } }