|
@@ -961,12 +961,12 @@ impl Core {
|
|
|
self.stop().await;
|
|
self.stop().await;
|
|
|
}
|
|
}
|
|
|
// 回撤风控3,加浮亏的回撤风控
|
|
// 回撤风控3,加浮亏的回撤风控
|
|
|
- let floating_profit = if !self.local_position.long_pos.is_zero() && !self.local_position.long_avg.is_zero() {
|
|
|
|
|
|
|
+ let floating_profit = if !self.local_position.long_pos.is_zero() && !self.local_position.long_avg.is_zero() && !self.strategy.mp.is_zero() {
|
|
|
let profit_price = self.strategy.mp - self.local_position.long_avg;
|
|
let profit_price = self.strategy.mp - self.local_position.long_avg;
|
|
|
|
|
|
|
|
profit_price * self.local_position.long_pos
|
|
profit_price * self.local_position.long_pos
|
|
|
- } else if !self.local_position.short_pos.is_zero() && !self.local_position.short_pos.is_zero() {
|
|
|
|
|
- let profit_price = self.local_position.short_pos - self.strategy.mp;
|
|
|
|
|
|
|
+ } else if !self.local_position.short_pos.is_zero() && !self.local_position.short_pos.is_zero() && !self.strategy.mp.is_zero() {
|
|
|
|
|
+ let profit_price = self.local_position.short_avg - self.strategy.mp;
|
|
|
|
|
|
|
|
profit_price * self.local_position.short_pos
|
|
profit_price * self.local_position.short_pos
|
|
|
} else {
|
|
} else {
|