Browse Source

进行日志方面的一些配合处理

skyfffire 2 years ago
parent
commit
1fcba247a9
3 changed files with 8 additions and 4 deletions
  1. 2 1
      strategy/src/lib.rs
  2. 5 2
      strategy/src/quant.rs
  3. 1 1
      strategy/src/strategy.rs

+ 2 - 1
strategy/src/lib.rs

@@ -3,4 +3,5 @@ pub mod model;
 mod strategy;
 mod predictor;
 mod utils;
-pub mod exchange_disguise;
+pub mod exchange_disguise;
+mod gp_predictor;

+ 5 - 2
strategy/src/quant.rs

@@ -488,6 +488,8 @@ impl Quant {
                         }
                         info!("成交单耗时数据:{}", time_record.to_string());
                         info!("更新推算仓位 {:?}", self.local_position_by_orders);
+                        // 打印各类信息
+                        self.strategy._print_summary();
                         // 本地计算利润
                         self._print_local_trades_summary();
                     }
@@ -1236,6 +1238,7 @@ pub fn run_strategy(quant_arc: Arc<Mutex<Quant>>) -> JoinHandle<()>{
                             let orders = quant.strategy.on_exit(&trade_msg);
                             if orders.is_not_empty() {
                                 info!("触发onExit");
+                                info!(?orders);
                                 quant._update_local_orders(&orders);
                                 spawn(async move {
                                     platform_rest_fb.command_order(orders).await;
@@ -1246,6 +1249,8 @@ pub fn run_strategy(quant_arc: Arc<Mutex<Quant>>) -> JoinHandle<()>{
                             let orders = quant.strategy.on_sleep(&trade_msg);
                             // 记录指令触发信息
                             if orders.is_not_empty() {
+                                info!("触发onSleep");
+                                info!(?orders);
                                 quant._update_local_orders(&orders);
                                 spawn(async move {
                                     platform_rest_fb.command_order(orders).await;
@@ -1294,8 +1299,6 @@ pub fn on_timer(quant_arc: Arc<Mutex<Quant>>) -> JoinHandle<()> {
                 quant.strategy.trade_vol_24h_w = trade_vol_24h / dec!(10000);
                 quant.strategy.trade_vol_24h_w.rescale(2);
 
-                // 打印各类信息
-                quant.strategy._print_summary();
                 // TODO quant没有rest
                 // info!("Rest报单平均延迟{}ms", quant.rest.avg_delay);
                 // info!("Rest报单最高延迟{}ms", quant.rest.max_delay);

+ 1 - 1
strategy/src/strategy.rs

@@ -401,7 +401,7 @@ impl Strategy {
         let o_num = self.local_orders.len();
 
         let mut msg = String::new();
-        msg.push_str("\n\n\n当前状态 >>>>>>>>>>>>>>>>>>\n");
+        msg.push_str("当前状态 >>>>>>>>>>>>>>>>>>\n");
         msg.push_str(format!("--品种 {}\n", self.params.pair).as_str());
         msg.push_str(format!("--现价 {:?}, 定价 {:?}, 偏差 {:?}%\n", self.mp, self.ref_price, price_bias).as_str());
         msg.push_str(format!("--净值 {:?}\n", self.equity).as_str());