Browse Source

图更新

skyffire 9 months ago
parent
commit
5ac8f170db
3 changed files with 23 additions and 24 deletions
  1. 11 12
      strategy/src/predictor.rs
  2. 1 1
      strategy/src/strategy.rs
  3. 11 11
      strategy/src/utils.rs

+ 11 - 12
strategy/src/predictor.rs

@@ -540,22 +540,21 @@ impl Predictor {
 
         // let cci_arc = self.cci_arc.clone();
         let now = Decimal::from_i64(Utc::now().timestamp_millis()).unwrap();
-        let mid_price = self.fair_price_std_vec[0] - self.mid_price;
-        let ask_price = self.ask_price;
-        let bid_price = self.bid_price;
-        let last_price = self.last_price;
-        let fair_price = self.fair_price_std_vec[1] - self.mid_price;
-
-        let spread = self.mid_price;
-        let spread_min = self.fair_price_std_vec[0];
-        let spread_max = self.fair_price_std_vec[1];
+        let mid_price = self.mid_price;
+        let ask_price = self.fair_price_std_vec[0];
+        let bid_price = self.fair_price_std_vec[1];
+        let last_price = Self::DONT_VIEW;
+        let fair_price = Self::DONT_VIEW;
+        let optimal_ask_price = Self::DONT_VIEW;
+        let optimal_bid_price = Self::DONT_VIEW;
+
+        let spread = Self::DONT_VIEW;
+        let spread_min = self.spread_vec[0];
+        let spread_max = self.spread_vec[1];
         // let spread = self.price_times_avg;
         // let spread_max = self.fair_price_vec[1] / self.fair_price_vec[0];
         // let spread_min = self.fair_price / self.mid_price;
 
-        let optimal_ask_price = self.optimal_ask_price;
-        let optimal_bid_price = self.optimal_bid_price;
-
         let inventory = self.inventory;
 
         let sigma_square = if self.fair_price_time_vec.len() > 1 {

+ 1 - 1
strategy/src/strategy.rs

@@ -1093,7 +1093,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

+ 11 - 11
strategy/src/utils.rs

@@ -261,7 +261,7 @@ pub fn build_html_file(data_c: &Vec<VecDeque<Option<Decimal>>>) -> String {
         },
         legend: [
           {
-            data: ["mid_price", "ask_price", "bid_price", "optimal_ask_price", "optimal_bid_price", "fair_price"],
+            data: ["mid_price", "fair0", "fair1", "optimal_ask_price", "optimal_bid_price", "fair_price"],
             top: "230px",
           },
           {
@@ -377,25 +377,25 @@ pub fn build_html_file(data_c: &Vec<VecDeque<Option<Decimal>>>) -> String {
             },
           },
           {
-            name: "ask_price",
+            name: "fair0",
             type: "line",
             showSymbol: false,
-            // data: data[2],
-            data: [],
+            data: data[2],
+            // data: [],
           },
           {
-            name: "bid_price",
+            name: "fair1",
             type: "line",
             showSymbol: false,
-            // data: data[3],
-            data: [],
+            data: data[3],
+            // data: [],
           },
           {
             name: "optimal_ask_price",
             type: "line",
             showSymbol: false,
-            // data: data[8],
-            data: [],
+            data: data[8],
+            // data: [],
             lineStyle: {
               type: "dashed",
             },
@@ -404,8 +404,8 @@ pub fn build_html_file(data_c: &Vec<VecDeque<Option<Decimal>>>) -> String {
             name: "optimal_bid_price",
             type: "line",
             showSymbol: false,
-            // data: data[9],
-            data: [],
+            data: data[9],
+            // data: [],
             lineStyle: {
               type: "dashed",
             },