|
|
@@ -120,6 +120,8 @@ impl AvellanedaStoikov {
|
|
|
let mut max_count = 0usize;
|
|
|
|
|
|
for (spread, count) in self.spread_count_map.iter() {
|
|
|
+ // info!(?spread, ?count);
|
|
|
+
|
|
|
if *count < max_count {
|
|
|
continue
|
|
|
}
|
|
|
@@ -127,6 +129,7 @@ impl AvellanedaStoikov {
|
|
|
self.spread_best = *spread;
|
|
|
max_count = *count;
|
|
|
}
|
|
|
+ // info!("======================")
|
|
|
}
|
|
|
|
|
|
pub fn update_spread(&mut self) {
|
|
|
@@ -142,7 +145,7 @@ impl AvellanedaStoikov {
|
|
|
self.spread_vec.push(self.spread);
|
|
|
self.spread_count_map.insert(self.spread, self.spread_count_map.get(&self.spread).unwrap_or(&0) + 1);
|
|
|
|
|
|
- if self.spread_vec.len() > 100_000 {
|
|
|
+ if self.spread_vec.len() > 1_000 {
|
|
|
let pop_value = self.spread_vec.remove(0);
|
|
|
self.spread_count_map.insert(pop_value, self.spread_count_map.get(&pop_value).unwrap() - 1);
|
|
|
}
|
|
|
@@ -233,7 +236,7 @@ impl AvellanedaStoikov {
|
|
|
}
|
|
|
|
|
|
pub fn update_sigma_square(&mut self) {
|
|
|
- self.sigma_square = self.spread_best;
|
|
|
+ self.sigma_square = self.spread_max * dec!(0.7);
|
|
|
self.sigma_square.rescale(10);
|
|
|
}
|
|
|
|