Remove asset_status thread
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -11,10 +11,10 @@ use tokio_tungstenite::{tungstenite::Message, MaybeTlsStream, WebSocketStream};
|
||||
|
||||
pub async fn authenticate(
|
||||
app_config: &Arc<Config>,
|
||||
sender: &mut SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>,
|
||||
receiver: &mut SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
|
||||
sink: &mut SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>,
|
||||
stream: &mut SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
|
||||
) {
|
||||
match receiver.next().await.unwrap().unwrap() {
|
||||
match stream.next().await.unwrap().unwrap() {
|
||||
Message::Text(data)
|
||||
if from_str::<Vec<websocket::incoming::Message>>(&data)
|
||||
.unwrap()
|
||||
@@ -25,20 +25,19 @@ pub async fn authenticate(
|
||||
_ => panic!("Failed to connect to Alpaca websocket."),
|
||||
}
|
||||
|
||||
sender
|
||||
.send(Message::Text(
|
||||
to_string(&websocket::outgoing::Message::Auth(
|
||||
websocket::outgoing::auth::Message {
|
||||
key: app_config.alpaca_api_key.clone(),
|
||||
secret: app_config.alpaca_api_secret.clone(),
|
||||
},
|
||||
))
|
||||
.unwrap(),
|
||||
sink.send(Message::Text(
|
||||
to_string(&websocket::outgoing::Message::Auth(
|
||||
websocket::outgoing::auth::Message {
|
||||
key: app_config.alpaca_api_key.clone(),
|
||||
secret: app_config.alpaca_api_secret.clone(),
|
||||
},
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
.unwrap(),
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match receiver.next().await.unwrap().unwrap() {
|
||||
match stream.next().await.unwrap().unwrap() {
|
||||
Message::Text(data)
|
||||
if from_str::<Vec<websocket::incoming::Message>>(&data)
|
||||
.unwrap()
|
||||
|
Reference in New Issue
Block a user