better Signals
This commit is contained in:
+64
-10
@@ -58,17 +58,71 @@ impl Formatted for EventLog {
|
||||
}
|
||||
}
|
||||
|
||||
impl Formatted for Signal {
|
||||
impl Formatted for SignalStatus {
|
||||
fn get_formatted(&self) -> Vec<String> {
|
||||
vec![
|
||||
if matches!(self.kind, Direction::Buy) {
|
||||
format!("\x1b[32m{}\x1b[0m", self.kind)
|
||||
} else {
|
||||
format!("\x1b[31m{}\x1b[0m", self.kind)
|
||||
},
|
||||
format!("\x1b[35m{}\x1b[0m", self.symbol),
|
||||
self.price.to_string(),
|
||||
]
|
||||
match self {
|
||||
Ok(RiskSignal::Approve(signal)) => {
|
||||
vec![
|
||||
format!("\x1b[33mOK\x1b[0m"),
|
||||
if matches!(signal.kind, Direction::Buy) {
|
||||
format!("\x1b[32mBUY\x1b[0m")
|
||||
} else {
|
||||
format!("\x1b[31mSELL\x1b[0m")
|
||||
},
|
||||
format!("\x1b[35m{}\x1b[0m", signal.symbol),
|
||||
signal.price.to_string(),
|
||||
format!("\x1b[33mAPR {}\x1b[0m", signal.confidence),
|
||||
]
|
||||
}
|
||||
Ok(RiskSignal::Reject {
|
||||
signal,
|
||||
rejection_confidence,
|
||||
reason,
|
||||
}) => {
|
||||
vec![
|
||||
format!("\x1b[33mOK\x1b[0m"),
|
||||
if matches!(signal.side, Direction::Buy) {
|
||||
format!("\x1b[32mBUY\x1b[0m")
|
||||
} else {
|
||||
format!("\x1b[31mSELL\x1b[0m")
|
||||
},
|
||||
format!("\x1b[35m{}\x1b[0m", signal.symbol),
|
||||
format!("\x1b[31mREJ {}\x1b[0m", rejection_confidence),
|
||||
reason.to_owned(),
|
||||
]
|
||||
}
|
||||
|
||||
Err(RiskSignal::Approve(signal)) => {
|
||||
vec![
|
||||
format!("\x1b[31mERR\x1b[0m"),
|
||||
if matches!(signal.kind, Direction::Buy) {
|
||||
format!("\x1b[32mBUY\x1b[0m")
|
||||
} else {
|
||||
format!("\x1b[31mSELL\x1b[0m")
|
||||
},
|
||||
format!("\x1b[35m{}\x1b[0m", signal.symbol),
|
||||
signal.price.to_string(),
|
||||
format!("\x1b[33mAPR {}\x1b[0m", signal.confidence),
|
||||
]
|
||||
}
|
||||
Err(RiskSignal::Reject {
|
||||
signal,
|
||||
rejection_confidence,
|
||||
reason,
|
||||
}) => {
|
||||
vec![
|
||||
format!("\x1b[31mERR\x1b[0m"),
|
||||
if matches!(signal.side, Direction::Buy) {
|
||||
format!("\x1b[32mBUY\x1b[0m")
|
||||
} else {
|
||||
format!("\x1b[31mSELL\x1b[0m")
|
||||
},
|
||||
format!("\x1b[35m{}\x1b[0m", signal.symbol),
|
||||
format!("\x1b[31mREJ {}\x1b[0m", rejection_confidence),
|
||||
reason.to_owned(),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct PulseTradeApp {
|
||||
watch_list: State<Vec<MarketItem>>,
|
||||
active_positions: State<Vec<Position>>,
|
||||
logs: State<Vec<EventLog>>,
|
||||
signals: State<Vec<Signal>>,
|
||||
signals: State<Vec<SignalStatus>>,
|
||||
inspect: State<InspectTarget>,
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ impl TerminalClient {
|
||||
watch_list: State<Vec<MarketItem>>,
|
||||
active_positions: State<Vec<Position>>,
|
||||
logs: State<Vec<EventLog>>,
|
||||
signals: State<Vec<Signal>>,
|
||||
signals: State<Vec<SignalStatus>>,
|
||||
market_overview: State<Option<Strategy>>,
|
||||
status: State<Option<Status>>,
|
||||
inspect: State<InspectTarget>,
|
||||
|
||||
Reference in New Issue
Block a user