|
|
@@ -6,11 +6,13 @@ use std::time::Duration;
|
|
|
use futures_util::StreamExt;
|
|
|
use tokio::sync::Mutex;
|
|
|
use tokio_tungstenite::tungstenite::Message;
|
|
|
-use tracing::trace;
|
|
|
+use tracing::{info, trace};
|
|
|
|
|
|
use exchanges::binance_swap_rest::BinanceSwapRest;
|
|
|
use exchanges::binance_swap_ws::{BinanceSwapLogin, BinanceSwapSubscribeType, BinanceSwapWs, BinanceSwapWsType};
|
|
|
+use exchanges::response_base::ResponseData;
|
|
|
use exchanges::socket_tool::AbstractWsMode;
|
|
|
+use global::trace_stack::TraceStack;
|
|
|
|
|
|
const ACCESS_KEY: &str = "";
|
|
|
const SECRET_KEY: &str = "";
|
|
|
@@ -23,7 +25,7 @@ async fn ws_custom_subscribe() {
|
|
|
|
|
|
|
|
|
let (write_tx, write_rx) = futures_channel::mpsc::unbounded();
|
|
|
- let (read_tx, mut read_rx) = futures_channel::mpsc::unbounded();
|
|
|
+ let (read_tx, mut read_rx) = futures_channel::mpsc::unbounded::<ResponseData>();
|
|
|
|
|
|
// let (write_tx, write_rx) = tokio::sync::broadcast::channel::<Message>(10);
|
|
|
// let (read_tx, mut read_rx) = tokio::sync::broadcast::channel::<ResponseData>(10);
|
|
|
@@ -47,7 +49,13 @@ async fn ws_custom_subscribe() {
|
|
|
trace!("线程-数据读取-开启");
|
|
|
loop {
|
|
|
if let Some(data) = read_rx.next().await {
|
|
|
- trace!("读取数据data:{:?}",data)
|
|
|
+ let mut trace_stack = TraceStack::default();
|
|
|
+ trace_stack.on_after_network(data.time);
|
|
|
+ trace_stack.on_before_unlock_quant();
|
|
|
+
|
|
|
+ if data.time != 0 {
|
|
|
+ info!("bian>{}", trace_stack.to_string());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// trace!("线程-数据读取-结束");
|