Enhancement #4: Failed Revenge Tracking - Added 3 database fields: revengeOutcome, revengePnL, revengeFailedReason - Added updateRevengeOutcome() method in stop-hunt-tracker.ts - Position Manager hooks revenge trade closes, records outcome - Enables data-driven analysis of revenge success rate Enhancement #10: Metadata Persistence - Added 4 database fields: firstCrossTime, lowestInZone, highestInZone, zoneResetCount - Migrated 90-second zone tracking from in-memory to database - Rewrote shouldExecuteRevenge() with database persistence - Container restarts now preserve exact zone tracking state Technical Details: - Prisma schema updated with 7 new StopHunt fields - Added signalSource field to ActiveTrade interface - All zone metadata persisted in real-time to database - Build verified successful (no TypeScript errors) Files Changed: - prisma/schema.prisma (StopHunt model + index) - lib/trading/stop-hunt-tracker.ts (DB persistence + outcome tracking) - lib/trading/position-manager.ts (revenge hook + interface) - docs/REVENGE_ENHANCEMENTS_EXPLAINED.md (comprehensive guide) Pending User Decision: - Enhancement #1: ADX confirmation (3 options explained in docs) - Enhancement #6: SL distance validation (2× ATR recommended) Status: Ready for deployment after Prisma migration Date: Nov 27, 2025
67 lines
2.6 KiB
Markdown
67 lines
2.6 KiB
Markdown
---
|
|
agent: agent
|
|
---
|
|
You are working on Trading Bot v4, a real money algorithmic trading system managing a user's capital from $901 → $100,000+. This is NOT a hobby project - every bug costs real money.
|
|
|
|
MANDATORY FIRST STEPS:
|
|
|
|
1. READ THE ENTIRE .github/copilot-instructions.md FILE
|
|
- Start at line 1 with the VERIFICATION MANDATE
|
|
- This is 4,400+ lines of critical context
|
|
- Every section matters - shortcuts cause financial losses
|
|
- Pay special attention to Common Pitfalls (60+ documented bugs)
|
|
- Clean up after yourself in code and documentation
|
|
- keep user data secure and private
|
|
- keep a clean structure for future developers
|
|
|
|
2. UNDERSTAND THE VERIFICATION ETHOS
|
|
- NEVER say "done", "fixed", "working" without 100% verification
|
|
- Code deployed ≠ Code working
|
|
- Always test in production with real data
|
|
- Add logging to confirm your changes execute
|
|
- Check container timestamp > commit timestamp
|
|
|
|
3. THIS IS A FINANCIAL SYSTEM
|
|
- Every change affects real money positions
|
|
- User cannot afford extended downtime or bugs
|
|
- Manual restarts = system failure
|
|
- Unverified changes = financial risk
|
|
|
|
4. BEFORE ANY WORK:
|
|
- Read relevant sections of copilot-instructions.md
|
|
- Check Common Pitfalls for similar issues
|
|
- Understand the architecture (Position Manager, Drift SDK, etc.)
|
|
- Know the verification requirements for your change type
|
|
|
|
5. AFTER ANY CHANGE:
|
|
- Build and deploy to production
|
|
- Verify container timestamp is newer than commit
|
|
- Add logging if needed to confirm execution
|
|
- Test the specific feature you changed
|
|
- Monitor logs for expected behavior
|
|
- Verify database state matches expectations
|
|
- Document what you tested and how
|
|
|
|
6. WHEN UNCERTAIN:
|
|
- Check Common Pitfalls first (60+ examples)
|
|
- Read the relevant code sections
|
|
- Test your assumptions with console.log
|
|
- Ask user for clarification rather than guessing
|
|
- Never assume documentation is correct - verify with logs
|
|
|
|
7. COMMUNICATION:
|
|
- Be concise but complete
|
|
- Show verification results, not just code changes
|
|
- Include actual logs/SQL/API responses as proof
|
|
- Explain what you tested and why it proves correctness
|
|
- Never claim something works without evidence
|
|
|
|
KEY FILES TO UNDERSTAND:
|
|
- .github/copilot-instructions.md (4,400 lines - READ ALL OF IT)
|
|
- lib/trading/position-manager.ts (1,500+ lines - core monitoring)
|
|
- lib/drift/client.ts (500+ lines - Drift SDK integration)
|
|
- Common Pitfalls section (60+ documented bugs to avoid)
|
|
|
|
REMEMBER: You're handling someone's financial future. Every change must be verified in production with real data before declaring success.
|
|
|
|
What task are you working on today? |