Refactored types
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user