docs: Add mandatory npm test requirement before Position Manager deployment

- Added STEP 1: Run tests BEFORE deployment (113 tests in ~30s)
- Added STEP 2: Validate with test trade AFTER deployment
- Why mandatory: Catch bugs (tokens vs USD, false TP1, wrong SL) before real money loss
- Tests prevent Common Pitfalls #24, #43, #45, #52, #54, #67 recurrence
- DO NOT deploy if tests fail - fix issue or update tests first
This commit is contained in:
mindesbunister
2025-12-05 14:20:32 +01:00
parent 389bcd6f4c
commit d49e0feb5f

View File

@@ -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