Selaa lähdekoodia

等待内部完成的版本。

skyfffire 1 vuosi sitten
vanhempi
commit
70b4c01df5
2 muutettua tiedostoa jossa 10 lisäystä ja 8 poistoa
  1. 4 2
      standard/src/gate_swap.rs
  2. 6 6
      strategy/src/core.rs

+ 4 - 2
standard/src/gate_swap.rs

@@ -3,6 +3,8 @@ use std::io::{Error, ErrorKind};
 use std::str::FromStr;
 use tokio::sync::mpsc::Sender;
 use async_trait::async_trait;
+use futures::stream::FuturesUnordered;
+use futures::TryStreamExt;
 use rust_decimal::Decimal;
 use rust_decimal::prelude::{FromPrimitive, ToPrimitive};
 use serde_json::json;
@@ -628,8 +630,8 @@ impl Platform for GateSwap {
             handles.push(handle)
         }
 
-        // let futures = FuturesUnordered::from_iter(handles);
-        // let _: Result<Vec<_>, _> = futures.try_collect().await;
+        let futures = FuturesUnordered::from_iter(handles);
+        let _: Result<Vec<_>, _> = futures.try_collect().await;
     }
 }
 

+ 6 - 6
strategy/src/core.rs

@@ -515,9 +515,9 @@ impl Core {
                             ts.on_before_send_thread();
                             ts.on_before_send();
                             // info!("update_order 订单指令:{:?}", order);
-                            // spawn(async move {
-                            platform_rest_fb.command_order(order, ts.clone()).await;
-                            // });
+                            spawn(async move {
+                                platform_rest_fb.command_order(order, ts.clone()).await;
+                            });
                         }
                     }
                 }
@@ -682,9 +682,9 @@ impl Core {
                     let mut ts = trace_stack.clone();
                     ts.on_order_command(orders.to_string());
                     // info!("_update_depth订单指令:{:?}", orders);
-                    // spawn(async move {
-                    platform_rest_fb.command_order(orders, ts.clone()).await;
-                    // });
+                    spawn(async move {
+                        platform_rest_fb.command_order(orders, ts.clone()).await;
+                    });
 
                     // 更新中控账户相关信息
                     {