Browse Source

kucoin参考kucoin报错解决

JiahengHe 2 years ago
parent
commit
dec61a5796
1 changed files with 6 additions and 8 deletions
  1. 6 8
      strategy/src/exchange_disguise.rs

+ 6 - 8
strategy/src/exchange_disguise.rs

@@ -322,14 +322,12 @@ async fn kucoin_swap_run(bool_v1 :Arc<AtomicBool>, type_num: i8, quant_arc: Arc<
                             min_sell = Decimal::ZERO;
                             quant.is_update.remove(str.as_str());
                         }
-                        let trades: Vec<OriginalTradeGa> = serde_json::from_str(data.data.as_str()).unwrap();
-                        for trade in trades {
-                            if trade.price > max_buy || max_buy == Decimal::ZERO {
-                                max_buy = trade.price
-                            }
-                            if trade.price < min_sell || min_sell == Decimal::ZERO {
-                                min_sell = trade.price
-                            }
+                        let trade: OriginalTradeGa = serde_json::from_str(data.data.as_str()).unwrap();
+                        if trade.price > max_buy || max_buy == Decimal::ZERO {
+                            max_buy = trade.price
+                        }
+                        if trade.price < min_sell || min_sell == Decimal::ZERO {
+                            min_sell = trade.price
                         }
                         quant.max_buy_min_sell_cache.insert(data.label, vec![max_buy, min_sell]);
                     }