mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-03 11:00:58 +08:00
Fixes #200 Previously, positions closed via stop-loss or take-profit were not recorded in decision logs, causing inaccurate performance metrics (win rate, profit factor, etc.) displayed in the frontend. This commit implements a position snapshot mechanism to detect auto-closed positions by comparing positions between trading cycles. Changes: - Add PositionSnapshot struct to track position state - Add detectAutoClosedPositions() to detect disappeared positions - Update position snapshots at cycle end (after AI execution) - Support auto_close_long/auto_close_short action types in logger - Ensure accurate performance analysis including auto-closed trades Key fix: - Snapshots are updated AFTER AI execution to avoid false positives - AI manual closes won't be mistakenly detected as auto-closes