Send strategy manifest to clients
This commit is contained in:
+26
-5
@@ -59,17 +59,38 @@ impl TerminalServer {
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_client(
|
||||
self: &Arc<Self>,
|
||||
id: &usize,
|
||||
mut reader: OwnedReadHalf,
|
||||
) -> tokio::io::Result<()> {
|
||||
async fn initialize_client(self: &Arc<Self>, id: &usize) -> tokio::io::Result<()> {
|
||||
let engine = self.get_engine();
|
||||
let pair = engine.strategy.pair.lock().await;
|
||||
|
||||
self.send_to(
|
||||
id,
|
||||
pulse_wire::terminal::TerminalServerMessage::StrategyUpdated(Strategy {
|
||||
strategy: pair.strategy_manifest.lock().await.clone(),
|
||||
risk: pair.risk_manifest.lock().await.clone(),
|
||||
mode: Mode::Auto,
|
||||
state: ItemState::Running,
|
||||
cooldown: TimeFrame::M15,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
|
||||
self.send_to(
|
||||
id,
|
||||
pulse_wire::terminal::TerminalServerMessage::SetLogs(self.logs.lock().await.clone()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_client(
|
||||
self: &Arc<Self>,
|
||||
id: &usize,
|
||||
mut reader: OwnedReadHalf,
|
||||
) -> tokio::io::Result<()> {
|
||||
self.initialize_client(id).await?;
|
||||
|
||||
loop {
|
||||
let mut len_buf = [0u8; size_of::<usize>()];
|
||||
let size = reader.read_exact(&mut len_buf).await?;
|
||||
|
||||
Reference in New Issue
Block a user