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