|
|
@@ -623,13 +623,18 @@ impl Predictor {
|
|
|
Decimal::MAX
|
|
|
};
|
|
|
|
|
|
+ // 刚开机要把条件限制的厉害一些。
|
|
|
+ let data_rate = Decimal::from(self.deviation_vec.len()) / Decimal::from(600);
|
|
|
+ let times = dec!(1) + dec!(5) * (dec!(1) - data_rate);
|
|
|
+ let amplitude_limit = dec!(1.5) * times;
|
|
|
+ let as_position_increase_distance = dec!(-0.0005) * times;
|
|
|
let is_open_long = self.inventory < self.params.grid
|
|
|
// && self.fair_price > self.mid_price * dec!(1.0002)
|
|
|
- && self.amplitude_times > dec!(1.5)
|
|
|
+ && self.amplitude_times > amplitude_limit
|
|
|
&& self.deviation < self.deviation_limit
|
|
|
&& self.trend < self.trend_limit
|
|
|
// AS加仓法的处理
|
|
|
- && (self.mid_price / prev_order_price - Decimal::ONE) < dec!(-0.0005) * self.inventory.abs()
|
|
|
+ && (self.mid_price / prev_order_price - Decimal::ONE) < as_position_increase_distance * self.inventory.abs()
|
|
|
;
|
|
|
|
|
|
let is_open_short = self.inventory.is_zero()
|