Refactored types

This commit is contained in:
2026-07-25 04:08:48 +02:00
parent cde2abf5f1
commit 6b6085ef25
8 changed files with 158 additions and 160 deletions
+6 -6
View File
@@ -1,8 +1,9 @@
use pulse_wire::terminal::{
ActivePosition, Alert, AlertLevel, EventLog, InspectItem, InspectTarget, LogKind,
MarketOverview, Signal, SignalKind, Status, WatchListItem,
Alert, AlertLevel, InspectItem, InspectTarget, MarketItem, MarketOverview, Status,
};
use pulse_wire::general::{Direction, EventLog, LogKind, Position, Signal};
pub trait Formatted {
fn get_formatted(&self) -> Vec<String>;
}
@@ -64,19 +65,18 @@ impl Formatted for EventLog {
impl Formatted for Signal {
fn get_formatted(&self) -> Vec<String> {
vec![
if matches!(self.kind, SignalKind::Buy) {
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),
format!("\x1b[34m{}\x1b[0m", self.param),
format_f64(self.price),
]
}
}
impl Formatted for WatchListItem {
impl Formatted for MarketItem {
fn get_formatted(&self) -> Vec<String> {
vec![
format!("\x1b[35m{}\x1b[0m", self.symbol),
@@ -95,7 +95,7 @@ impl Formatted for WatchListItem {
}
}
impl Formatted for ActivePosition {
impl Formatted for Position {
fn get_formatted(&self) -> Vec<String> {
vec![
format!("\x1b[35m{}\x1b[0m", self.symbol),