|
@@ -53,6 +53,7 @@ impl AvellanedaStoikov {
|
|
|
// 时间窗口大小(微秒)
|
|
// 时间窗口大小(微秒)
|
|
|
const MAX_TIME_RANGE_MICROS: i64 = 3 * 60_000_000;
|
|
const MAX_TIME_RANGE_MICROS: i64 = 3 * 60_000_000;
|
|
|
const TRADE_LONG_RANGE_MICROS: i64 = 3 * 60_000_000;
|
|
const TRADE_LONG_RANGE_MICROS: i64 = 3 * 60_000_000;
|
|
|
|
|
+ const SPREAD_RANGE_MICROS: i64 = 6 * 60_000_000;
|
|
|
const TRADE_SHORT_RANGE_MICROS: i64 = 60_000_000;
|
|
const TRADE_SHORT_RANGE_MICROS: i64 = 60_000_000;
|
|
|
// const ONE_MILLION: Decimal = dec!(1_000_000);
|
|
// const ONE_MILLION: Decimal = dec!(1_000_000);
|
|
|
// const TWENTY_THOUSAND: Decimal = dec!(20_000);
|
|
// const TWENTY_THOUSAND: Decimal = dec!(20_000);
|
|
@@ -65,7 +66,7 @@ impl AvellanedaStoikov {
|
|
|
fair_price_vec: vec![Decimal::ZERO; 10],
|
|
fair_price_vec: vec![Decimal::ZERO; 10],
|
|
|
|
|
|
|
|
// 老的队列
|
|
// 老的队列
|
|
|
- spread_vec: FixedTimeRangeDeque::new(Self::MAX_TIME_RANGE_MICROS),
|
|
|
|
|
|
|
+ spread_vec: FixedTimeRangeDeque::new(Self::SPREAD_RANGE_MICROS),
|
|
|
trade_long_vec: FixedTimeRangeDeque::new(Self::TRADE_LONG_RANGE_MICROS),
|
|
trade_long_vec: FixedTimeRangeDeque::new(Self::TRADE_LONG_RANGE_MICROS),
|
|
|
trade_short_vec: FixedTimeRangeDeque::new(Self::TRADE_SHORT_RANGE_MICROS),
|
|
trade_short_vec: FixedTimeRangeDeque::new(Self::TRADE_SHORT_RANGE_MICROS),
|
|
|
record_vec: VecDeque::new(),
|
|
record_vec: VecDeque::new(),
|
|
@@ -230,7 +231,7 @@ impl AvellanedaStoikov {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn update_sigma_square(&mut self) {
|
|
pub fn update_sigma_square(&mut self) {
|
|
|
- self.sigma_square = self.spread_max * dec!(0.6);
|
|
|
|
|
|
|
+ self.sigma_square = self.spread_max * dec!(0.5);
|
|
|
self.sigma_square.rescale(10);
|
|
self.sigma_square.rescale(10);
|
|
|
}
|
|
}
|
|
|
|
|
|