Engine status

This commit is contained in:
2026-07-31 04:20:32 +02:00
parent 7247319a38
commit 405dbdda2e
5 changed files with 82 additions and 44 deletions
+1 -34
View File
@@ -1,6 +1,5 @@
use crate::{
general::{EventLog, Position, Signal},
strategy::StrategyManifest,
general::{EventLog, ItemState, Mode, Position, Signal}, strategy::StrategyManifest,
};
use hypersdk::{Decimal, hypercore::CandleInterval};
@@ -66,19 +65,6 @@ pub struct Status {
pub latency: u16,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum Mode {
Auto,
Manual,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum ItemState {
Running,
Stopped,
Error,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct StrategyStatus {
pub strategy: StrategyManifest,
@@ -87,22 +73,3 @@ pub struct StrategyStatus {
pub state: ItemState,
pub cooldown: CandleInterval,
}
impl std::fmt::Display for Mode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Auto => write!(f, "\x1b[96mAUTO\x1b[0m"),
Self::Manual => write!(f, "\x1b[97mMANUAL\x1b[0m"),
}
}
}
impl std::fmt::Display for ItemState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Running => write!(f, "\x1b[92mRUNNING\x1b[0m"),
Self::Stopped => write!(f, "\x1b[90mSTOPPED\x1b[0m"),
Self::Error => write!(f, "\x1b[91mERROR\x1b[0m"),
}
}
}