Files
nofx/logger
Xeron 5c9b396e5a fix: detect and record stop-loss/take-profit auto-close trades
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
2025-11-02 12:35:37 +08:00
..