|
@@ -1,3 +1,4 @@
|
|
|
|
|
+use std::fmt::format;
|
|
|
use std::io::Read;
|
|
use std::io::Read;
|
|
|
use std::sync::Arc;
|
|
use std::sync::Arc;
|
|
|
use std::sync::atomic::AtomicBool;
|
|
use std::sync::atomic::AtomicBool;
|
|
@@ -130,20 +131,19 @@ impl MexcSpotWs {
|
|
|
// 深度
|
|
// 深度
|
|
|
MexcSpotWsSubscribeType::PuFuturesDepth => {
|
|
MexcSpotWsSubscribeType::PuFuturesDepth => {
|
|
|
json!({
|
|
json!({
|
|
|
- "method":"sub.depth",
|
|
|
|
|
- "param":{
|
|
|
|
|
- "symbol": symbol
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ "method": "SUBSCRIPTION",
|
|
|
|
|
+ "param": [
|
|
|
|
|
+ format!("spot@public.aggre.depth.v3.api.pb@10ms@{symbol}")
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
// k线
|
|
// k线
|
|
|
MexcSpotWsSubscribeType::PuFuturesRecords(interval) => {
|
|
MexcSpotWsSubscribeType::PuFuturesRecords(interval) => {
|
|
|
json!({
|
|
json!({
|
|
|
- "method":"sub.kline",
|
|
|
|
|
- "param":{
|
|
|
|
|
- "symbol": symbol,
|
|
|
|
|
- "interval": interval
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ "method": "SUBSCRIPTION",
|
|
|
|
|
+ "param": [
|
|
|
|
|
+ format!("spot@public.kline.v3.api.pb@{symbol}@{interval}")
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -287,8 +287,6 @@ impl MexcSpotWs {
|
|
|
res_data.channel = "futures.order_book".to_string();
|
|
res_data.channel = "futures.order_book".to_string();
|
|
|
} else if method.contains(".kline") {
|
|
} else if method.contains(".kline") {
|
|
|
res_data.channel = "futures.candlesticks".to_string();
|
|
res_data.channel = "futures.candlesticks".to_string();
|
|
|
- } else if method.contains(".deal") {
|
|
|
|
|
- res_data.channel = "futures.trades".to_string();
|
|
|
|
|
} else {
|
|
} else {
|
|
|
res_data.channel = "未知频道推送".to_string();
|
|
res_data.channel = "未知频道推送".to_string();
|
|
|
}
|
|
}
|