Browse Source

实盘测试

skyfffire 11 tháng trước cách đây
mục cha
commit
b9820af629
2 tập tin đã thay đổi với 10 bổ sung10 xóa
  1. 9 9
      strategy/src/avellaneda_stoikov.rs
  2. 1 1
      strategy/src/strategy.rs

+ 9 - 9
strategy/src/avellaneda_stoikov.rs

@@ -351,16 +351,16 @@ impl AvellanedaStoikov {
             // let v0_rate = self.volume_vec[0] / (self.volume_vec[0] + self.volume_vec[1]);
             // let v1_rate = self.volume_vec[1] / (self.volume_vec[0] + self.volume_vec[1]);
 
-            // let sma = self.depth_vec[1].asks[0].price;
-            // let smb = self.depth_vec[1].bids[0].price;
-            //
-            // let mp0 = self.mid_price;
-            // let mp1 = (sma + smb) / Decimal::TWO;
-            //
-            // let price_diff = mp0 - mp1;
+            let sma = self.depth_vec[1].asks[0].price;
+            let smb = self.depth_vec[1].bids[0].price;
+
+            let mp0 = self.mid_price;
+            let mp1 = (sma + smb) / Decimal::TWO;
+
+            let price_diff = mp0 - mp1;
 
-            // self.ref_price = (self.fair_price_vec[0] + self.fair_price_vec[1] + price_diff) / Decimal::TWO;
-            self.ref_price = (self.fair_price_vec[0] + self.fair_price_vec[1]) / Decimal::TWO;
+            self.ref_price = (self.fair_price_vec[0] + self.fair_price_vec[1] + price_diff) / Decimal::TWO;
+            // self.ref_price = (self.fair_price_vec[0] + self.fair_price_vec[1]) / Decimal::TWO;
         }
     }
 

+ 1 - 1
strategy/src/strategy.rs

@@ -1109,7 +1109,7 @@ impl Strategy {
         self.fix_price(predictor);
 
         self._cancel_open(&mut command, local_orders);              // 撤单命令处理
-        // self._post_open(&mut command, local_orders, predictor);     // 限价单命令处理
+        self._post_open(&mut command, local_orders, predictor);     // 限价单命令处理
         self._check_local_orders(&mut command, local_orders);       // 固定时间检查超时订单
         self._update_in_cancel(&mut command, local_orders);         // 更新撤单队列,是一个filter
         self._check_request_limit(&mut command);                    // 限制频率,移除不合规则之订单,是一个filter