diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1254745..21e9591 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -3223,7 +3223,16 @@ if (!enabled) { - Log shows: `📊 ATR-based targets: TP1 X.XX%, TP2 Y.YY%, SL Z.ZZ%` - Verify targets fall within safety bounds (TP1: 0.5-1.5%, TP2: 1.0-3.0%, SL: 0.8-2.0%) - Update Telegram manual trade presets if median ATR changes (currently 0.43 for SOL) -10. **Position Manager changes:** ALWAYS execute test trade after deployment +10. **Position Manager changes:** ALWAYS run tests BEFORE deployment, then validate in production + - **STEP 1 - Run tests locally (MANDATORY):** + ```bash + npm test # Run all 113 tests (takes ~30 seconds) + # OR run specific test file: + npm test tests/integration/position-manager/tp1-detection.test.ts + ``` + - **Why mandatory:** Tests catch bugs (tokens vs USD, TP1 false detection, wrong SL price) BEFORE they cost real money + - **If tests fail:** Fix the issue or update tests - DO NOT deploy broken code + - **STEP 2 - Deploy and validate with test trade:** - Use `/api/trading/test` endpoint or Telegram `long sol --force` - Monitor `docker logs -f trading-bot-v4` for full cycle - Verify TP1 hit → 75% close → SL moved to breakeven