mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 03:07:56 +08:00
d23628a5a1
Fixes #652 Previously, peakPnLCache used only 'symbol' as the key, causing LONG and SHORT positions of the same symbol to share the same peak P&L value. This led to incorrect drawdown calculations and emergency close triggers. Changes: - checkPositionDrawdown: use posKey (symbol_side) for cache access - UpdatePeakPnL: add side parameter and use posKey internally - ClearPeakPnLCache: add side parameter and use posKey internally Example fix: - Before: peakPnLCache["BTCUSDT"] shared by both LONG and SHORT - After: peakPnLCache["BTCUSDT_long"] and peakPnLCache["BTCUSDT_short"] Impact: - Fixes incorrect drawdown monitoring for dual positions - Prevents false emergency close triggers on profitable positions