Browse Source

数据敏感度

skyfffire 11 months ago
parent
commit
735e81290a
2 changed files with 6 additions and 6 deletions
  1. 1 1
      global/src/cci.rs
  2. 5 5
      strategy/src/avellaneda_stoikov.rs

+ 1 - 1
global/src/cci.rs

@@ -16,7 +16,7 @@ pub struct CentralControlInfo {
 
 impl CentralControlInfo {
     // 时间窗口大小(微秒)
-    const MAX_TIME_RANGE_MICROS: i64 = 30 * 60_000_000;
+    const MAX_TIME_RANGE_MICROS: i64 = 2 * 60 * 60_000_000;
 
     pub fn new() -> Self {
         Self {

+ 5 - 5
strategy/src/avellaneda_stoikov.rs

@@ -177,7 +177,7 @@ impl AvellanedaStoikov {
             //     self.spread_short_vec.push(self.spread);
             // }
 
-            while self.spread_vec.len() > 2_000 && self.inventory.is_zero() {
+            while self.spread_vec.len() > 500 && self.inventory.is_zero() {
                 self.spread_vec.remove(0);
             }
 
@@ -503,10 +503,10 @@ impl AvellanedaStoikov {
         let flow_ratio = Decimal::ZERO;
         let ref_price = self.ref_price;
 
-        // let need_append = now - self.prev_insert_time > Decimal::TEN;
-        // if !need_append {
-        //     return;
-        // }
+        let need_append = now - self.prev_insert_time > Decimal::TEN;
+        if !need_append {
+            return;
+        }
 
         self.prev_insert_time = now;
         // 数据量太多导致的,减少一些吧