fix: 收敛退出放宽到0.02%+净利为正, 恢复到0.02%即退不亏钱

This commit is contained in:
jackyu66git
2026-05-04 01:55:22 +08:00
parent 51b8ee0c8a
commit 1c0618583c
3 changed files with 88 additions and 4 deletions
+9 -2
View File
@@ -534,12 +534,19 @@ func (t *Trader) checkExit(pos *ArbPosition, bgP, hlP, diffPct float64, notifier
exitReason = "利润止盈"
}
// Exit when spread converges to zero or reverses (prices same or flipped)
if diffPct <= 0 {
// Convergence exit: spread narrowed significantly and we're profitable
// Prevents positions from sitting at near-zero spread waiting for timeout
if diffPct <= 0.02 && netPnl > 0 {
shouldExit = true
exitReason = "价差收敛止盈"
}
// Emergency reversal: spread flipped negative — cut losses
if diffPct < 0 {
shouldExit = true
exitReason = "价差反转平仓"
}
// Timeout: configured max hold time
if elapsed > t.cfg.PositionTimeout {
shouldExit = true