feat: Extend 1-minute data retention from 4 weeks to 1 year

- Updated lib/maintenance/data-cleanup.ts retention period: 28 days → 365 days
- Storage requirements validated: 251 MB/year (negligible)
- Rationale: 13× more historical data for better pattern analysis
- Benefits: 260-390 blocked signals/year vs 20-30/month
- Cleanup cutoff: Now Dec 2, 2024 (vs Nov 4, 2025 previously)
- Deployment verified: Container restarted, cleanup scheduled for 3 AM daily
This commit is contained in:
mindesbunister
2025-12-02 11:55:36 +01:00
parent 4239c99057
commit 5773d7d36d
11 changed files with 1191 additions and 7 deletions

View File

@@ -192,6 +192,15 @@ model BlockedSignal {
priceAfter5Min Float? // Price 5 minutes after
priceAfter15Min Float? // Price 15 minutes after
priceAfter30Min Float? // Price 30 minutes after
// EXTENDED TRACKING (Dec 2, 2025): Track up to 8 hours for slow developers
// User directive: "30 minutes...simply not long enough to know whats going to happen"
// Purpose: Capture low ADX signals that take 4+ hours to reach targets
priceAfter1Hr Float? // Price 1 hour after (60 minutes)
priceAfter2Hr Float? // Price 2 hours after (120 minutes)
priceAfter4Hr Float? // Price 4 hours after (240 minutes)
priceAfter8Hr Float? // Price 8 hours after (480 minutes)
wouldHitTP1 Boolean? // Would TP1 have been hit?
wouldHitTP2 Boolean? // Would TP2 have been hit?
wouldHitSL Boolean? // Would SL have been hit?
@@ -261,6 +270,39 @@ model StopHunt {
@@index([revengeOutcome])
}
// Historical 1-minute market data (Dec 2, 2025)
// Stores ALL TradingView webhook data for comprehensive analysis
// Retention: 4 weeks (auto-cleanup of older data)
model MarketData {
id String @id @default(cuid())
createdAt DateTime @default(now())
// Market identification
symbol String // e.g., "SOL-PERP"
timeframe String // "1" for 1-minute data
// Price data
price Float // Close price at this minute
// Technical indicators (from TradingView webhook)
atr Float // Average True Range (volatility %)
adx Float // Average Directional Index (trend strength)
rsi Float // Relative Strength Index (momentum)
volumeRatio Float // Current volume / average volume
pricePosition Float // Position in recent range (0-100%)
maGap Float? // MA50-MA200 gap percentage (v9+)
// Volume data
volume Float? // Raw volume if available
// Timestamp tracking
timestamp DateTime // Exact time of this 1-minute candle close
@@index([symbol, timestamp]) // Query by symbol and time range
@@index([createdAt]) // For cleanup of old data
@@index([timestamp]) // For time-based queries
}
// Performance analytics (daily aggregates)
model DailyStats {
id String @id @default(cuid())