64 lines
1.5 KiB
Rust
64 lines
1.5 KiB
Rust
use crate::units::{Direction, Symbol, USD};
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub enum MarketTrend {
|
|
Bullish,
|
|
Bearish,
|
|
Neutral,
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub enum LogKind {
|
|
Info,
|
|
Warn,
|
|
Err,
|
|
Debug,
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
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,
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct EventLog {
|
|
pub kind: LogKind,
|
|
pub name: String,
|
|
pub message: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
|
pub struct Position {
|
|
pub symbol: Symbol,
|
|
pub size: f64,
|
|
pub entry_price: USD,
|
|
pub profit: USD,
|
|
}
|
|
|
|
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 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"),
|
|
}
|
|
}
|
|
}
|