Fix inconsistencies
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
pub mod command;
|
pub mod command;
|
||||||
pub mod plugin;
|
|
||||||
pub mod execution;
|
pub mod execution;
|
||||||
|
pub mod plugin;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
engine::plugin::StrategyEngine,
|
engine::plugin::StrategyEngine,
|
||||||
@@ -11,7 +11,7 @@ use pulse_sdk::prelude::*;
|
|||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{collections::HashMap, sync::Arc};
|
||||||
use tokio::{sync::Mutex, task::JoinHandle};
|
use tokio::{sync::Mutex, task::JoinHandle};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct WatchList {
|
pub struct WatchList {
|
||||||
pub name_to_index: HashMap<String, usize>,
|
pub name_to_index: HashMap<String, usize>,
|
||||||
pub items: Vec<MarketItem>,
|
pub items: Vec<MarketItem>,
|
||||||
@@ -71,11 +71,7 @@ impl Engine {
|
|||||||
|
|
||||||
if let Err(error) = self
|
if let Err(error) = self
|
||||||
.terminal_server
|
.terminal_server
|
||||||
.broadcast(
|
.broadcast(TerminalServerMessage::WatchListUpdated(watch_list.items))
|
||||||
pulse_sdk::terminal::TerminalServerMessage::WatchListUpdated(
|
|
||||||
watch_list.items,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
self.terminal_server
|
self.terminal_server
|
||||||
@@ -103,8 +99,7 @@ impl Engine {
|
|||||||
match client.clearinghouse_state(acc.address, None).await {
|
match client.clearinghouse_state(acc.address, None).await {
|
||||||
Ok(state) => {
|
Ok(state) => {
|
||||||
self.terminal_server
|
self.terminal_server
|
||||||
.broadcast(
|
.broadcast(TerminalServerMessage::PositionsUpdated(
|
||||||
pulse_sdk::terminal::TerminalServerMessage::PositionsUpdated(
|
|
||||||
state
|
state
|
||||||
.asset_positions
|
.asset_positions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -118,8 +113,7 @@ impl Engine {
|
|||||||
profit: USD(position.position.unrealized_pnl),
|
profit: USD(position.position.unrealized_pnl),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
))
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ impl TerminalServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send_to_client(client: &mut OwnedWriteHalf, msg: &[u8]) -> tokio::io::Result<()> {
|
pub async fn send_to_client(client: &mut OwnedWriteHalf, msg: &[u8]) -> tokio::io::Result<()> {
|
||||||
client.write(&msg.len().to_le_bytes()).await?;
|
client.write_all(&msg.len().to_le_bytes()).await?;
|
||||||
client.write(msg).await?;
|
client.write_all(msg).await?;
|
||||||
client.flush().await?;
|
client.flush().await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ impl TerminalClient {
|
|||||||
message: pulse_sdk::terminal::TerminalClientMessage,
|
message: pulse_sdk::terminal::TerminalClientMessage,
|
||||||
) -> tokio::io::Result<()> {
|
) -> tokio::io::Result<()> {
|
||||||
let msg = map_postcard_err(postcard::to_allocvec(&message))?;
|
let msg = map_postcard_err(postcard::to_allocvec(&message))?;
|
||||||
self.writer.write(&msg.len().to_le_bytes()).await?;
|
self.writer.write_all(&msg.len().to_le_bytes()).await?;
|
||||||
self.writer.write(&msg).await?;
|
self.writer.write_all(&msg).await?;
|
||||||
self.writer.flush().await?;
|
self.writer.flush().await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user