Engine status
This commit is contained in:
@@ -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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user