Add Position Sync feature for recovering tracking after partial fills
- New /api/trading/sync-positions endpoint (no auth) - Fetches actual Drift positions and compares with Position Manager - Removes stale tracking, adds missing positions with calculated TP/SL - Settings UI: Orange 'Sync Positions' button added - CLI script: scripts/sync-positions.sh for terminal access - Full documentation in docs/guides/POSITION_SYNC_GUIDE.md - Quick reference: POSITION_SYNC_QUICK_REF.md - Updated AI instructions with pitfall #23 Problem solved: Manual Telegram trades with partial fills can cause Position Manager to lose tracking, leaving positions without software- based stop loss protection. This feature restores dual-layer protection. Note: Docker build not picking up route yet (cache issue), needs investigation
This commit is contained in:
12
scripts/sync-positions.sh
Executable file
12
scripts/sync-positions.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Sync Position Manager with actual Drift positions
|
||||
# Useful when things get out of sync (partial fills, restarts, manual trades)
|
||||
#
|
||||
|
||||
source /home/icke/traderv4/.env
|
||||
|
||||
curl -X POST http://localhost:3001/api/trading/sync-positions \
|
||||
-H "Authorization: Bearer ${API_SECRET_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
| jq '.'
|
||||
Reference in New Issue
Block a user