Fix inconsistencies

This commit is contained in:
2026-07-29 04:30:26 +02:00
parent 5f1b5c9aad
commit 90d3c59ff4
3 changed files with 22 additions and 28 deletions
+18 -24
View File
@@ -1,6 +1,6 @@
pub mod command;
pub mod plugin;
pub mod execution;
pub mod plugin;
use crate::{
engine::plugin::StrategyEngine,
@@ -11,7 +11,7 @@ use pulse_sdk::prelude::*;
use std::{collections::HashMap, sync::Arc};
use tokio::{sync::Mutex, task::JoinHandle};
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WatchList {
pub name_to_index: HashMap<String, usize>,
pub items: Vec<MarketItem>,
@@ -71,11 +71,7 @@ impl Engine {
if let Err(error) = self
.terminal_server
.broadcast(
pulse_sdk::terminal::TerminalServerMessage::WatchListUpdated(
watch_list.items,
),
)
.broadcast(TerminalServerMessage::WatchListUpdated(watch_list.items))
.await
{
self.terminal_server
@@ -103,23 +99,21 @@ impl Engine {
match client.clearinghouse_state(acc.address, None).await {
Ok(state) => {
self.terminal_server
.broadcast(
pulse_sdk::terminal::TerminalServerMessage::PositionsUpdated(
state
.asset_positions
.into_iter()
.map(|position| Position {
symbol: Symbol(position.position.coin),
size: position.position.szi.as_f64(),
entry_price: USD(position
.position
.entry_px
.unwrap_or_default()),
profit: USD(position.position.unrealized_pnl),
})
.collect(),
),
)
.broadcast(TerminalServerMessage::PositionsUpdated(
state
.asset_positions
.into_iter()
.map(|position| Position {
symbol: Symbol(position.position.coin),
size: position.position.szi.as_f64(),
entry_price: USD(position
.position
.entry_px
.unwrap_or_default()),
profit: USD(position.position.unrealized_pnl),
})
.collect(),
))
.await?;
}
Err(e) => {
+2 -2
View File
@@ -164,8 +164,8 @@ impl TerminalServer {
}
pub async fn send_to_client(client: &mut OwnedWriteHalf, msg: &[u8]) -> tokio::io::Result<()> {
client.write(&msg.len().to_le_bytes()).await?;
client.write(msg).await?;
client.write_all(&msg.len().to_le_bytes()).await?;
client.write_all(msg).await?;
client.flush().await?;
Ok(())