Эх сурвалжийг харах

Merge branch 'master' of http://git.skyfffire.com/skyfffire/as-rust

875428575@qq.com 2 жил өмнө
parent
commit
68e2936932
1 өөрчлөгдсөн 9 нэмэгдсэн , 7 устгасан
  1. 9 7
      strategy/src/quant.rs

+ 9 - 7
strategy/src/quant.rs

@@ -934,6 +934,7 @@ pub async fn run_transaction(quant_arc: Arc<Mutex<Quant>>, name: String, symbols
         loop {
             match rx.recv().await {
                 Some(data) => {
+                    info!(?data);
                     if data.code == "200" {
                         if data.channel == "futures.order_book" {
                             let depth = standard::gate_handle::handle_special_depth(data);
@@ -992,13 +993,14 @@ pub async fn run_transaction(quant_arc: Arc<Mutex<Quant>>, name: String, symbols
                                 min_sell = Decimal::ZERO;
                                 quant.is_update.remove(str.as_str());
                             }
-                            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
+                            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
+                                }
                             }
                             quant.max_buy_min_sell_cache.insert(data.lable, vec![max_buy, min_sell]);
                         }