875428575@qq.com 2 年之前
父节点
当前提交
dba11a52dc
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      exchanges/src/kucoin_swap_ws.rs

+ 8 - 8
exchanges/src/kucoin_swap_ws.rs

@@ -179,28 +179,28 @@ impl KucoinSwapWs {
     //订阅枚举解析
     pub fn enum_to_string(symbol: String, subscribe_type: KucoinSubscribeType) -> serde_json::Value {
         match subscribe_type {
-            KucoinSubscribeType::PuContractMarketLevel2Depth50 => {
+            KucoinSubscribeType::PuContractMarketLevel2Depth50 => {//level2
                 serde_json::json!({
                      "topic": format!("/contractMarket/level2Depth50:{}", symbol),
                      "type": "subscribe",
                      "response": true
                 })
             }
-            KucoinSubscribeType::PuContractMarketExecution => {
+            KucoinSubscribeType::PuContractMarketExecution => {//match
                 serde_json::json!({
                      "topic": format!("/contractMarket/execution:{}", symbol),
                      "type": "subscribe",
                      "response": true
                 })
             }
-            KucoinSubscribeType::PuContractMarkettickerV2 => {
+            KucoinSubscribeType::PuContractMarkettickerV2 => {//tickerV2
                 serde_json::json!({
                      "topic": format!("/contractMarket/tickerV2:{}", symbol),
                      "type": "subscribe",
                      "response": true
                 })
             }
-            KucoinSubscribeType::PrContractAccountWallet => {
+            KucoinSubscribeType::PrContractAccountWallet => {//orderMargin.change
                 serde_json::json!({
                     "type": "subscribe",
                     "topic": "/contractAccount/wallet",
@@ -208,7 +208,7 @@ impl KucoinSwapWs {
                     "response":true,
                 })
             }
-            KucoinSubscribeType::PrContractPosition => {
+            KucoinSubscribeType::PrContractPosition => {//position.change
                 serde_json::json!({
                     "type": "subscribe",
                     "topic": format!("/contract/position:{}", symbol),
@@ -216,7 +216,7 @@ impl KucoinSwapWs {
                     "response":true,
                 })
             }
-            KucoinSubscribeType::PrContractMarketTradeOrdersSys => {
+            KucoinSubscribeType::PrContractMarketTradeOrdersSys => {//orderChange
                 serde_json::json!({
                     "type": "subscribe",
                     "topic": format!("/contractMarket/tradeOrders"),
@@ -224,7 +224,7 @@ impl KucoinSwapWs {
                     "response":true,
                 })
             }
-            KucoinSubscribeType::PrContractMarketTradeOrders => {
+            KucoinSubscribeType::PrContractMarketTradeOrders => {//symbolOrderChange
                 serde_json::json!({
                     "type": "subscribe",
                     "topic": format!("/contractMarket/tradeOrders:{}", symbol),
@@ -493,7 +493,7 @@ impl KucoinSwapWs {
             res_data.code = format!("{}", json_value["code"]);
             res_data.message = format!("{}", json_value["data"].as_str().unwrap());
         } else if json_value.get("topic").is_some() {
-            res_data.channel = format!("{}", json_value["topic"].as_str().unwrap());
+            res_data.channel = format!("{}", json_value["subject"].as_str().unwrap());
 
             if json_value["topic"].as_str() == Option::from("/contractAccount/wallet") {
                 res_data.code = "-202".to_string();