|
|
@@ -226,11 +226,10 @@ impl Predictor {
|
|
|
(self.pos_avg_price - self.mid_price) / self.pos_avg_price
|
|
|
};
|
|
|
|
|
|
- let mul = Decimal::ONE_HUNDRED * (Decimal::ONE - self.t_diff);
|
|
|
// self.profit_fixed_vec.push();
|
|
|
|
|
|
// let total: Decimal = self.profit_fixed_vec.iter().sum();
|
|
|
- self.profit_point = profit_now * mul;
|
|
|
+ self.profit_point = profit_now;
|
|
|
self.profit_point_ema = self.profit_point_ema * dec!(0.99) + self.profit_point * dec!(0.01);
|
|
|
}
|
|
|
}
|
|
|
@@ -459,7 +458,7 @@ impl Predictor {
|
|
|
}
|
|
|
}
|
|
|
// 更新程序关注的平仓焦点
|
|
|
- let close_activate = self.params.open_activate;
|
|
|
+ let close_activate = self.params.open_activate / Decimal::TWO;
|
|
|
if self.fair_rate_focus_close.is_zero() && !self.inventory.is_zero() && close_rate.abs() > close_activate {
|
|
|
// 多单平仓逻辑
|
|
|
if self.inventory > Decimal::ZERO && close_rate > Decimal::ZERO {
|
|
|
@@ -499,7 +498,7 @@ impl Predictor {
|
|
|
}
|
|
|
|
|
|
// ============================ 止损逻辑处理 =======================
|
|
|
- if self.fair_rate_focus_close.is_zero() && !self.inventory.is_zero() && self.profit_point < dec!(-0.0314159) {
|
|
|
+ if self.fair_rate_focus_close.is_zero() && !self.inventory.is_zero() && self.profit_point < self.params.open_activate * dec!(-5) {
|
|
|
self.fair_rate_focus_close = dec!(-0.0314159);
|
|
|
self.fair_price_focus_close = self.mid_price;
|
|
|
|