|
|
@@ -386,17 +386,13 @@ impl Predictor {
|
|
|
|
|
|
let is_close_long = self.inventory > Decimal::ZERO && (
|
|
|
// 反转平仓1
|
|
|
- (self.fair_price < self.mid_price * (Decimal::ONE - self.params.close))
|
|
|
- // 反转平仓2
|
|
|
- || (self.trend_rate > self.params.open * dec!(7))
|
|
|
+ (self.trend_rate > self.params.open * dec!(7))
|
|
|
// 达到最大持仓时间还未盈利就平仓
|
|
|
|| (now - self.prev_open_time > is_holding_time_over && self.mid_price < self.pos_avg_price)
|
|
|
);
|
|
|
let is_close_short = self.inventory < Decimal::ZERO && (
|
|
|
// 反转平仓1
|
|
|
- (self.fair_price > self.mid_price * (Decimal::ONE + self.params.close))
|
|
|
- // 反转平仓2
|
|
|
- || (self.trend_rate < self.params.open * dec!(-7))
|
|
|
+ (self.trend_rate < self.params.open * dec!(-7))
|
|
|
// 达到最大持仓时间还未盈利就平仓
|
|
|
|| (now - self.prev_open_time > is_holding_time_over && self.mid_price > self.pos_avg_price)
|
|
|
);
|