docs: MANDATORY copilot-instructions.md updates + 1-min data direction field

CRITICAL: Added iron-clad rule that copilot-instructions.md MUST be updated
for every significant change. User is 'sick and tired' of reminding.

New mandatory section explains:
- When to update this file (8 specific scenarios)
- Why it's the primary knowledge base for future developers
- Automatic workflow: Change → Code → Test → Update Docs → Commit

1-Minute Data Collection documented:
- Direction field is meaningless (TradingView artifact)
- Analysis should ignore direction for timeframe='1'
- Focus on ADX/ATR/RSI/volume/price position metrics
- Example correct vs wrong SQL queries

This is NON-NEGOTIABLE going forward.
This commit is contained in:
mindesbunister
2025-11-27 19:32:22 +01:00
parent 8310a5c42b
commit 2749c08d15

View File

@@ -137,6 +137,77 @@ User relies on roadmap for strategic planning. Wrong roadmap = wrong decisions =
--- ---
## 📝 MANDATORY: COPILOT-INSTRUCTIONS.MD UPDATES - ABSOLUTE REQUIREMENT
**⚠️ CRITICAL: THIS IS NON-NEGOTIABLE - USER IS "SICK AND TIRED" OF REMINDING ⚠️**
### IRON-CLAD RULE: UPDATE THIS FILE FOR EVERY SIGNIFICANT CHANGE
**When to update .github/copilot-instructions.md (MANDATORY):**
1. **New system behaviors discovered** (like 1-minute signal direction field artifacts)
2. **Data integrity requirements** (what fields are meaningful vs meaningless)
3. **Analysis patterns** (how to query data correctly, what to filter out)
4. **Architecture changes** (new components, integrations, data flows)
5. **Database schema additions** (new tables, fields, their purpose and usage)
6. **Configuration patterns** (ENV variables, feature flags, precedence rules)
7. **Common mistakes** (add to Common Pitfalls section immediately)
8. **Verification procedures** (how to test features, what to check)
**This file is the PRIMARY KNOWLEDGE BASE for all future AI agents and developers.**
**What MUST be documented here:**
- ✅ Why things work the way they do (not just what they do)
- ✅ What fields/data should be filtered out in analysis
- ✅ How to correctly query and interpret database data
- ✅ Known artifacts and quirks (like direction field in 1-min signals)
- ✅ Data collection vs trading signal distinctions
- ✅ When features are truly deployed vs just committed
**DO NOT make user remind you to update this file. It's AUTOMATIC:**
```
Change → Code → Test → Git Commit → UPDATE COPILOT-INSTRUCTIONS.MD → Git Commit
```
**If you implement something without documenting it here, the work is INCOMPLETE.**
---
## 📊 1-Minute Data Collection System (Nov 27, 2025)
**Purpose:** Real-time market data collection via TradingView 1-minute alerts for Phase 7.1/7.2/7.3 enhancements
**Data Flow:**
- TradingView 1-minute chart → Alert fires every minute with metrics
- n8n Parse Signal Enhanced → Bot execute endpoint
- Timeframe='1' detected → Saved to BlockedSignal (DATA_COLLECTION_ONLY)
- Market data cache updated every 60 seconds
- Used by: Smart Entry Timer validation, Revenge system ADX checks, Adaptive trailing stops
**CRITICAL: Direction Field is Meaningless**
- All 1-minute signals in BlockedSignal have `direction='long'` populated
- This is an **artifact of TradingView alert syntax** (requires buy/sell trigger word to fire)
- These are **NOT trading signals** - they are pure market data samples
- **For analysis:** ALWAYS filter out or ignore direction field for timeframe='1'
- **Focus on:** ADX, ATR, RSI, volumeRatio, pricePosition (actual market conditions)
- **Example wrong query:** `WHERE timeframe='1' AND direction='long' AND signalQualityScore >= 90`
- **Example correct query:** `WHERE timeframe='1' AND signalQualityScore >= 90` (no direction filter)
**Database Fields:**
- `timeframe='1'` → 1-minute data collection
- `blockReason='DATA_COLLECTION_ONLY'` → Not a blocked trade, just data sample
- `direction='long'` → IGNORE THIS (TradingView artifact, not real direction)
- `signalQualityScore` → Quality score calculated but NOT used for execution threshold
- `adx`, `atr`, `rsi`, `volumeRatio`, `pricePosition`**THESE ARE THE REAL DATA**
**Why This Matters:**
- Prevents confusion when analyzing 1-minute data
- Ensures correct SQL queries for market condition analysis
- Direction-based analysis on 1-min data is meaningless and misleading
- Future developers won't waste time investigating "why all signals are long"
---
## Mission & Financial Goals ## Mission & Financial Goals
**Primary Objective:** Build wealth systematically from $106 → $100,000+ through algorithmic trading **Primary Objective:** Build wealth systematically from $106 → $100,000+ through algorithmic trading