Quellcode durchsuchen

1. 开放挂单
2. 不要乱干扰平仓
3. 使用fair挂单

skyffire vor 9 Monaten
Ursprung
Commit
b97f1d679e
3 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 2 2
      strategy/src/predictor.rs
  2. 1 1
      strategy/src/strategy.rs
  3. 3 3
      strategy/src/utils.rs

+ 2 - 2
strategy/src/predictor.rs

@@ -313,8 +313,8 @@ impl Predictor {
             }
         }
 
-        let is_close_long = self.inventory > Decimal::ZERO && self.signal > Decimal::ZERO;
-        let is_close_short = self.inventory < Decimal::ZERO && self.signal < Decimal::ZERO;
+        let is_close_long = self.inventory > Decimal::ZERO;
+        let is_close_short = self.inventory < Decimal::ZERO;
 
         if is_close_long {
             self.ask_delta = dec!(0);

+ 1 - 1
strategy/src/strategy.rs

@@ -1091,7 +1091,7 @@ impl Strategy {
 
         self._cancel_open(&mut command, local_orders, predictor);   // 撤单命令处理
         self._post_close(&mut command, local_orders, predictor);    // 平仓单命令处理
-        // 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

+ 3 - 3
strategy/src/utils.rs

@@ -261,7 +261,7 @@ pub fn build_html_file(data_c: &Vec<VecDeque<Option<Decimal>>>) -> String {
         },
         legend: [
           {
-            data: ["mid_price", "fair0", "fair1", "optimal_ask_price", "optimal_bid_price"],
+            data: ["mid_price", "fair0", "fair1", "optimal_ask_price", "optimal_bid_price", "fair_price"],
             top: "230px",
           },
           {
@@ -414,8 +414,8 @@ pub fn build_html_file(data_c: &Vec<VecDeque<Option<Decimal>>>) -> String {
             name: "fair_price",
             type: "line",
             showSymbol: false,
-            // data: data[15],
-            data: []
+            data: data[15],
+            // data: []
           },
 
           {