|
|
@@ -9,6 +9,7 @@ use tokio_tungstenite::tungstenite::{Error, Message};
|
|
|
use tracing::{info, trace};
|
|
|
|
|
|
use ring::hmac;
|
|
|
+use tracing_subscriber::fmt::format;
|
|
|
|
|
|
use crate::response_base::ResponseData;
|
|
|
use crate::socket_tool::{AbstractWsMode, HeartbeatType};
|
|
|
@@ -299,13 +300,17 @@ impl BybitSwapWs {
|
|
|
} else if json_value.get("topic").is_some() && json_value.get("data").is_some() {
|
|
|
let channel = json_value["topic"].to_string();
|
|
|
res_data.data = format!("{}", json_value.get("data").as_ref().unwrap());
|
|
|
+ // bybit 时间在data块外
|
|
|
+ res_data.reach_time = json_value.get("ts").unwrap().as_i64().unwrap_or(0i64);
|
|
|
res_data.code = "200".to_string();
|
|
|
|
|
|
|
|
|
if channel.contains("orderbook") {
|
|
|
res_data.channel = "orderbook".to_string();
|
|
|
+ res_data.data_type = json_value["type"].as_str().unwrap().to_string();
|
|
|
} else if channel.contains("publicTrade") {
|
|
|
res_data.channel = "trade".to_string();
|
|
|
+ res_data.data_type = json_value["type"].as_str().unwrap().to_string();
|
|
|
} else if channel.contains("tickers") {
|
|
|
res_data.channel = "tickers".to_string();
|
|
|
} else if channel.contains("kline") {
|