浏览代码

修复迷一般的挂单距离问题

skyffire 9 月之前
父节点
当前提交
d257e89889
共有 1 个文件被更改,包括 1 次插入23 次删除
  1. 1 23
      strategy/src/predictor.rs

+ 1 - 23
strategy/src/predictor.rs

@@ -1,4 +1,4 @@
-use std::cmp::{max, min};
+use std::cmp::{max};
 use std::collections::{BTreeMap, VecDeque};
 use std::sync::Arc;
 use chrono::{Utc};
@@ -437,27 +437,6 @@ impl Predictor {
         self.optimal_bid_price.rescale(self.mid_price.scale());
     }
 
-    pub fn update_optimal_ask_and_bid(&mut self) {
-        self.optimal_ask_price = if self.ask_delta == dec!(-1) {
-            self.bid_price
-        } else if self.ask_delta == dec!(-2) {
-            Self::DONT_VIEW
-        } else {
-            max(self.ask_price + self.ask_delta, self.bid_price)
-        };
-
-        self.optimal_bid_price = if self.bid_delta == dec!(-1) {
-            self.ask_price
-        } else if self.bid_delta == dec!(-2) {
-            Self::DONT_VIEW
-        } else {
-            min(self.bid_price - self.bid_delta, self.ask_price)
-        };
-
-        self.optimal_ask_price.rescale(self.mid_price.scale());
-        self.optimal_bid_price.rescale(self.mid_price.scale());
-    }
-
     pub fn update_t_diff(&mut self) {
         if self.prev_trade_time > 0 {
             let time_diff_decimal = Decimal::from_i64(Utc::now().timestamp_micros() - self.prev_trade_time).unwrap();
@@ -507,7 +486,6 @@ impl Predictor {
 
         self.update_t_diff();
         self.update_delta();
-        self.update_optimal_ask_and_bid();
 
         // let mut smm = Decimal::ZERO;
         // if !self.depth_vec[1].time.is_zero() {