Pulse terminal communication

This commit is contained in:
2026-07-22 00:40:36 +02:00
parent 2df381d334
commit 5affe1adf0
7 changed files with 23 additions and 19 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
pub mod ptc;
fn main() { fn main() {
println!("Hello, World!") println!("Hello, World!")
} }
+1
View File
@@ -0,0 +1 @@
include!("../ptc.rs");
+2 -2
View File
@@ -1,4 +1,4 @@
use crate::{PulseTradeApp, types::EventLog}; use crate::{PulseTradeApp, ptc::EventLog};
impl PulseTradeApp { impl PulseTradeApp {
pub async fn execute_command(&mut self, ctx: &pulse_ui::state::Context, command: &str) { pub async fn execute_command(&mut self, ctx: &pulse_ui::state::Context, command: &str) {
@@ -19,7 +19,7 @@ impl PulseTradeApp {
_ => { _ => {
self.logs.lock().await.push(EventLog { self.logs.lock().await.push(EventLog {
kind: crate::types::LogKind::Err, kind: crate::ptc::LogKind::Err,
name: "cmd", name: "cmd",
message: format!("Command '{}' not found", command), message: format!("Command '{}' not found", command),
}); });
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::types::{ use crate::ptc::{
ActivePosition, Alert, AlertLevel, EventLog, InspectTarget, LogKind, MarketOverview, Signal, ActivePosition, Alert, AlertLevel, EventLog, InspectTarget, LogKind, MarketOverview, Signal,
SignalKind, Status, WatchListItem, SignalKind, Status, WatchListItem,
}; };
+15 -15
View File
@@ -1,6 +1,6 @@
pub mod command; pub mod command;
pub mod formatting; pub mod formatting;
pub mod types; pub mod ptc;
use std::any::Any; use std::any::Any;
@@ -20,7 +20,7 @@ use pulse_ui::{
use crate::{ use crate::{
formatting::{Formatted, apply_padding}, formatting::{Formatted, apply_padding},
types::{ ptc::{
ActivePosition, Alert, EventLog, InspectTarget, MarketOverview, Signal, Status, ActivePosition, Alert, EventLog, InspectTarget, MarketOverview, Signal, Status,
WatchListItem, WatchListItem,
}, },
@@ -88,30 +88,30 @@ impl App for PulseTradeApp {
let mut signals = self.signals.lock().await; let mut signals = self.signals.lock().await;
signals.push(Signal { signals.push(Signal {
kind: types::SignalKind::Buy, kind: ptc::SignalKind::Buy,
symbol: "BTC".to_string(), symbol: "BTC".to_string(),
param: types::SignalParameter::Lim, param: ptc::SignalParameter::Lim,
price: 118_800.0, price: 118_800.0,
}); });
signals.push(Signal { signals.push(Signal {
kind: types::SignalKind::Buy, kind: ptc::SignalKind::Buy,
symbol: "BTC".to_string(), symbol: "BTC".to_string(),
param: types::SignalParameter::Tap, param: ptc::SignalParameter::Tap,
price: 120_000.0, price: 120_000.0,
}); });
signals.push(Signal { signals.push(Signal {
kind: types::SignalKind::Buy, kind: ptc::SignalKind::Buy,
symbol: "BTC".to_string(), symbol: "BTC".to_string(),
param: types::SignalParameter::Stl, param: ptc::SignalParameter::Stl,
price: 118_000.0, price: 118_000.0,
}); });
let mut logs = self.logs.lock().await; let mut logs = self.logs.lock().await;
logs.push(EventLog { logs.push(EventLog {
kind: types::LogKind::Warn, kind: ptc::LogKind::Warn,
name: "pulse.init", name: "pulse.init",
message: "We're still not done yet ;)".to_string(), message: "We're still not done yet ;)".to_string(),
}); });
@@ -119,17 +119,17 @@ impl App for PulseTradeApp {
let mut market_overview = self.market_overview.lock().await; let mut market_overview = self.market_overview.lock().await;
market_overview.alerts.push(Alert { market_overview.alerts.push(Alert {
level: types::AlertLevel::High, level: ptc::AlertLevel::High,
message: "BTC funding rate elevated".to_string(), message: "BTC funding rate elevated".to_string(),
}); });
market_overview.alerts.push(Alert { market_overview.alerts.push(Alert {
level: types::AlertLevel::Medium, level: ptc::AlertLevel::Medium,
message: "Market volatility increasing".to_string(), message: "Market volatility increasing".to_string(),
}); });
market_overview.alerts.push(Alert { market_overview.alerts.push(Alert {
level: types::AlertLevel::Low, level: ptc::AlertLevel::Low,
message: "ETH volatility returning to normal".to_string(), message: "ETH volatility returning to normal".to_string(),
}); });
} }
@@ -282,13 +282,13 @@ async fn main() {
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(MarketOverview { market_overview: ctx.use_state(MarketOverview {
trend: types::MarketTrend::Bullish, trend: ptc::MarketTrend::Bullish,
volatility: types::Volatility::High, volatility: ptc::Volatility::High,
pressure: 0.324, pressure: 0.324,
alerts: Vec::new(), alerts: Vec::new(),
}), }),
status: ctx.use_state(Status { status: ctx.use_state(Status {
feed: types::Feed::Connected, feed: ptc::Feed::Connected,
exchange: "Binance".to_string(), exchange: "Binance".to_string(),
dex: "DEX SCREENER".to_string(), dex: "DEX SCREENER".to_string(),
latency: 18, latency: 18,
+1
View File
@@ -0,0 +1 @@
include!("../ptc.rs");