Selaa lähdekoodia

写入framework3.0的最新改动

JiahengHe 1 vuosi sitten
vanhempi
commit
0f9c6dbd5d

+ 1 - 1
global/src/params.rs

@@ -101,7 +101,7 @@ impl Params {
             log_level: "info".to_string(),
             log_level: "info".to_string(),
             port: call_port,
             port: call_port,
             run_mode: 0,
             run_mode: 0,
-            r_id: "-1".to_string(),
+            r_id: "-1".to_string()
         };
         };
         Ok(params)
         Ok(params)
     }
     }

+ 6 - 3
standard/src/coinex_swap.rs

@@ -643,8 +643,11 @@ impl Platform for CoinexSwap {
             let handle = spawn(async move {
             let handle = spawn(async move {
                 let result = self_clone.cancel_order(&order_id, &custom_id).await;
                 let result = self_clone.cancel_order(&order_id, &custom_id).await;
                 match result {
                 match result {
-                    Ok(_) => {
-                        // self_clone.order_sender.send(order).await.unwrap();
+                    Ok(order) => {
+                        if order.status == "REMOVE" {
+                            // 由于有时撤单成功ws不推送,所以加入rest
+                            self_clone.order_sender.send(order).await.unwrap();
+                        }
                     }
                     }
                     Err(error) => {
                     Err(error) => {
                         // info!("撤单失败:{:?}", error.to_string());
                         // info!("撤单失败:{:?}", error.to_string());
@@ -762,7 +765,7 @@ pub fn format_order_item(order: Value, ct_val: Decimal, status: &str) -> Order {
         avg_price,
         avg_price,
         status: custom_status,
         status: custom_status,
         order_type: "limit".to_string(),
         order_type: "limit".to_string(),
-        trace_stack: TraceStack::new(0, Instant::now()).on_special("688 trace_stack".to_string()),
+        trace_stack: TraceStack::new(0, Instant::now()).on_special("765 trace_stack".to_string()),
     };
     };
     return rst_order;
     return rst_order;
 }
 }

+ 1 - 1
standard/src/handle_info.rs

@@ -258,7 +258,7 @@ pub fn make_special_depth(label: String, depth_asks: &mut Vec<MarketOrder>, dept
     }
     }
 }
 }
 
 
-pub fn  format_depth(exchange: ExchangeEnum, res_data: &ResponseData) -> DepthParam {
+pub fn format_depth(exchange: ExchangeEnum, res_data: &ResponseData) -> DepthParam {
     let depth_asks: Vec<MarketOrder>;
     let depth_asks: Vec<MarketOrder>;
     let depth_bids: Vec<MarketOrder>;
     let depth_bids: Vec<MarketOrder>;
     let t: Decimal;
     let t: Decimal;

+ 6 - 4
strategy/src/clear_core.rs

@@ -465,11 +465,12 @@ impl ClearCore {
         match self.platform_rest.get_positions().await {
         match self.platform_rest.get_positions().await {
             Ok(val) => {
             Ok(val) => {
                 info!("检查仓位信息");
                 info!("检查仓位信息");
-                result.clear_position_num = val.len().to_string();
+                let mut position_num = 0;
                 for position in val {
                 for position in val {
                     if position.amount.eq(&Decimal::ZERO) {
                     if position.amount.eq(&Decimal::ZERO) {
                         continue;
                         continue;
                     }
                     }
+                    position_num = position_num + 1;
                     info!("    仓位:{:?}", position);
                     info!("    仓位:{:?}", position);
                     let price = Decimal::ZERO;
                     let price = Decimal::ZERO;
                     let side;
                     let side;
@@ -516,6 +517,7 @@ impl ClearCore {
                         }
                         }
                     };
                     };
                 }
                 }
+                result.clear_position_num = position_num.to_string();
             }
             }
             Err(error) => {
             Err(error) => {
                 result.clear_other_err = true;
                 result.clear_other_err = true;
@@ -531,13 +533,13 @@ impl ClearCore {
 
 
 
 
     // #[instrument(skip(self), level="TRACE")]
     // #[instrument(skip(self), level="TRACE")]
-    pub async fn exit(&mut self, check_id: String) -> bool {
+    pub async fn exit(&mut self, r_id: String) -> bool {
         info!("-------------------------启动退出流程({})----------------------------", self.exit_msg);
         info!("-------------------------启动退出流程({})----------------------------", self.exit_msg);
         info!("");
         info!("");
 
 
         let mut result = self.check_position().await;
         let mut result = self.check_position().await;
         // 设置机器人id
         // 设置机器人id
-        result.r_id = check_id;
+        result.r_id = r_id;
         info!("清仓程序结果 {:?}", result);
         info!("清仓程序结果 {:?}", result);
         // 判断是否有清仓,是否有异常
         // 判断是否有清仓,是否有异常
         if result.clear_position_num != "0" || result.clear_order_num != "0" || result.clear_other_err{
         if result.clear_position_num != "0" || result.clear_order_num != "0" || result.clear_other_err{
@@ -642,7 +644,7 @@ pub async fn send_clear_msg_request(body_params: &ClearPositionResult) {
 
 
     // 发送 POST 请求
     // 发送 POST 请求
     let res = client
     let res = client
-        .post("https://t4lapi.skyfffire.com/api/report/searchPositions")
+        .post("https://4lapi.skyfffire.com/api/report/searchPositions")
         .body(body)
         .body(body)
         .headers(headers)
         .headers(headers)
         .send()
         .send()