replaced market overview
This commit is contained in:
@@ -14,8 +14,8 @@ pub enum TerminalServerMessage {
|
||||
// Positions
|
||||
PositionsUpdated(Vec<Position>),
|
||||
|
||||
// Overview
|
||||
OverviewUpdated(MarketOverview),
|
||||
// Strategy
|
||||
StrategyUpdated(Strategy),
|
||||
|
||||
// Signals
|
||||
SignalsUpdated(Vec<Signal>),
|
||||
|
||||
@@ -151,7 +151,7 @@ impl Formatted for Status {
|
||||
|
||||
impl Formatted for Property {
|
||||
fn get_formatted(&self) -> Vec<String> {
|
||||
vec![format!("\x1b[91m{}\x1b[0m", self.0), self.1.clone()]
|
||||
vec![self.0.to_string(), self.1.clone()]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,12 @@ impl<T: Formatted> Formatted for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Formatted for Strategy {
|
||||
fn get_formatted(&self) -> Vec<String> {
|
||||
vec![format!("1"), format!("2")]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply_padding(mut items: Vec<String>) -> Vec<String> {
|
||||
for item in &mut items {
|
||||
item.insert(0, ' ');
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct PulseTradeApp {
|
||||
command: State<InputState>,
|
||||
scroll: State<ScrollState<7>>,
|
||||
|
||||
market_overview: State<Option<MarketOverview>>,
|
||||
strategy: State<Option<Strategy>>,
|
||||
status: State<Option<Status>>,
|
||||
|
||||
watch_list: State<Vec<MarketItem>>,
|
||||
@@ -134,13 +134,7 @@ impl App for PulseTradeApp {
|
||||
(
|
||||
LayoutItem::Widget(Size::Flex(1)),
|
||||
Box::new(
|
||||
advanced_option_draw(
|
||||
&self.scroll,
|
||||
2,
|
||||
"MARKET OVERVIEW",
|
||||
&self.market_overview,
|
||||
)
|
||||
.await,
|
||||
advanced_option_draw(&self.scroll, 2, "STRATEGY", &self.strategy).await,
|
||||
),
|
||||
),
|
||||
]),
|
||||
@@ -187,7 +181,7 @@ async fn main() -> tokio::io::Result<()> {
|
||||
signals: ctx.use_state(Vec::new()),
|
||||
logs: ctx.use_state(Vec::new()),
|
||||
inspect: ctx.use_state(InspectTarget::None),
|
||||
market_overview: ctx.use_state(None),
|
||||
strategy: ctx.use_state(None),
|
||||
status: ctx.use_state(None),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ impl TerminalClient {
|
||||
let active_positions = app.active_positions.clone();
|
||||
let logs = app.logs.clone();
|
||||
let signals = app.signals.clone();
|
||||
let market_overview = app.market_overview.clone();
|
||||
let market_overview = app.strategy.clone();
|
||||
let status = app.status.clone();
|
||||
let inspect = app.inspect.clone();
|
||||
|
||||
@@ -78,7 +78,7 @@ impl TerminalClient {
|
||||
*active_positions.lock().await = v;
|
||||
}
|
||||
|
||||
TerminalServerMessage::OverviewUpdated(v) => {
|
||||
TerminalServerMessage::StrategyUpdated(v) => {
|
||||
*market_overview.lock().await = Some(v);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user