|
|
@@ -582,28 +582,6 @@ impl SocketTool {
|
|
|
okx_ping_off = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // // writeln!(stdout, "---接收数据:{0}", text).unwrap();
|
|
|
- // //转json
|
|
|
- // let json_value: serde_json::Value = serde_json::from_str(&text).unwrap();
|
|
|
- // if json_value.get("result").is_some() {
|
|
|
- // writeln!(stdout, "-币安--订阅成功:{0}", text).unwrap();
|
|
|
- // } else if json_value.get("event").is_some() {
|
|
|
- // writeln!(stdout, "-OKX--订阅成功:{0}", text).unwrap();
|
|
|
- // } else {
|
|
|
- // // --推送数据
|
|
|
- // // writeln!(stdout, "---推送数据:{0}", text).unwrap();
|
|
|
- // let rsp_data = ResponseData::new("0".to_string(),
|
|
|
- // "success".to_string(),
|
|
|
- // text);
|
|
|
- //
|
|
|
- // let parse_fn = Arc::clone(&parse_fn); // Clone the Arc for each iteration
|
|
|
- //
|
|
|
- // tokio::spawn(async move {
|
|
|
- // let parse_fn = parse_fn.lock().await;
|
|
|
- // parse_fn(rsp_data).await;
|
|
|
- // });
|
|
|
- // }
|
|
|
}
|
|
|
Ok(Message::Ping(s)) => {
|
|
|
writeln!(stdout, "Ping-响应--{:?}", String::from_utf8(s)).unwrap();
|
|
|
@@ -820,7 +798,15 @@ impl SocketTool {
|
|
|
} else {
|
|
|
// --推送数据
|
|
|
// writeln!(stdout, "---推送数据:{0}", text).unwrap();
|
|
|
- rsp_data.code = "0".parse().unwrap()
|
|
|
+ let rsp_json: serde_json::Value = serde_json::from_str(&*text).unwrap();
|
|
|
+ if rsp_json.get("arg").is_some() {
|
|
|
+ let channel = rsp_json["arg"]["channel"].as_str().unwrap_or("----");
|
|
|
+ if channel != "account" {
|
|
|
+ rsp_data.code = "0".parse().unwrap();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rsp_data.code = "0".parse().unwrap();
|
|
|
+ }
|
|
|
}
|
|
|
rsp_data
|
|
|
}
|
|
|
@@ -907,6 +893,12 @@ impl SocketTool {
|
|
|
map.insert("instId".to_string(), b_name.to_string());
|
|
|
args.push(map);
|
|
|
}
|
|
|
+
|
|
|
+ let mut map_acc: HashMap<String, String> = HashMap::new();
|
|
|
+ // 添加键值对
|
|
|
+ map_acc.insert("channel".to_string(), "account".to_string());
|
|
|
+ map_acc.insert("ccy".to_string(), "USDT".to_string());
|
|
|
+ args.push(map_acc);
|
|
|
SocketTool::okx_pr_run(b_array, args, btree_map, parse_fn);
|
|
|
}
|
|
|
|