Browse Source

flow_ratio_short

skyffire 1 year ago
parent
commit
45b7b15f50
1 changed files with 2 additions and 8 deletions
  1. 2 8
      strategy/src/avellaneda_stoikov.rs

+ 2 - 8
strategy/src/avellaneda_stoikov.rs

@@ -43,7 +43,6 @@ pub struct AvellanedaStoikov {
     pub base_delta: Decimal,                                                    // 基础挂单距离
     pub ratio_edge: Decimal,                                                    // 资金流修正的挂单距离
     pub ref_price: Decimal,                                                     // 预定价格
-    pub init_delta_plus: Decimal,                                               // 最初的delta之和
 
     pub cci_arc: Arc<Mutex<CentralControlInfo>>,                                // 中控信息
 
@@ -88,7 +87,6 @@ impl AvellanedaStoikov {
             ask_delta: Default::default(),
             bid_delta: Default::default(),
             base_delta: Default::default(),
-            init_delta_plus: Default::default(),
 
             ratio_edge: Default::default(),
             kappa: Default::default(),
@@ -252,10 +250,10 @@ impl AvellanedaStoikov {
             self.bid_delta = self.base_delta;
             self.ask_delta = self.base_delta;
 
-            if self.flow_ratio_long > Decimal::ZERO {
+            if self.flow_ratio_short > Decimal::ZERO {
                 self.ask_delta = self.ask_delta + self.ratio_edge;
                 self.bid_delta = self.bid_delta - self.ratio_edge;
-            } else if self.flow_ratio_long < Decimal::ZERO {
+            } else if self.flow_ratio_short < Decimal::ZERO {
                 self.ask_delta = self.ask_delta - self.ratio_edge;
                 self.bid_delta = self.bid_delta + self.ratio_edge;
             }
@@ -267,10 +265,6 @@ impl AvellanedaStoikov {
                 self.ask_delta += pos_edge;
                 self.bid_delta = Decimal::ZERO;
             }
-
-            if self.init_delta_plus.is_zero() {
-                self.init_delta_plus = (self.bid_delta + self.ask_delta) / Decimal::TWO
-            }
         }
     }