Scan only M15 and H1; keep D1 as confirmation, drop W1 entirely

Trades are intraday (M15/H1) only. D1 stays as a confirmation TF
for both so higher-timeframe trend context still gates A/A+ grades.
W1 is no longer used anywhere — removes one batch call.

Scan now: 3 batch calls (M15, H1, D1) × 7 pairs = 21 credits, ~2 min.
Was:      4 batch calls (M15, H1, D1, W1) = 28 credits, ~3 min.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Harwinder
2026-05-05 14:13:44 -04:00
parent 2f6eed7309
commit 492b39313a
2 changed files with 15 additions and 17 deletions
+12 -13
View File
@@ -43,30 +43,30 @@ After every fetch the data goes through `_validate_and_clean`:
### Per scan or /signal command
The bot does **one shared prefetch** before spawning the 4 TF analyses.
It collects all unique timeframes needed across all scans, then makes
The bot does **one shared prefetch** before spawning TF analyses.
It collects all unique timeframes needed across scans, then makes
one batch API call per timeframe (all pairs in a single request).
Current SCAN_TIMEFRAMES: M15, H1, D1, W1
Current SCAN_TIMEFRAMES: M15, H1 (only intraday trade signals)
Confirmations:
- M15 uses: H1, D1
- H1 uses: M15, D1
- D1 uses: H1, W1
- W1 uses: D1
Unique timeframes: M15, H1, D1, W1 = **4 batch calls**
D1 is kept as a confirmation for higher-timeframe trend context but
no D1 trade signals are produced. W1 has been dropped entirely.
Unique timeframes: M15, H1, D1 = **3 batch calls**
Each call: 7 pairs × 1 credit = **7 credits per call**
Total per scan: **4 calls × 7 credits = 28 credits**
Total per scan: **3 calls × 7 credits = 21 credits**
With the 8 credits/minute limit:
- Call 1 (7 credits): fires immediately — 1 credit remaining
- Call 2 (7 credits): must wait ~60s for window to clear
- Call 3 (7 credits): waits another ~60s
- Call 4 (7 credits): waits another ~60s
**Minimum scan time: ~3 minutes.**
**Minimum scan time: ~2 minutes.**
After the shared prefetch, the 4 concurrent TF analyses read from
the in-memory cache and make **zero additional API calls**.
@@ -204,13 +204,12 @@ Telegram /scan or /signal
▼
_analyze_all_tfs(pairs)
│
├── prefetch_batch(pairs, [M15, H1, D1, W1])
├── prefetch_batch(pairs, [M15, H1, D1])
│ ├── Batch call 1: all pairs @ M15 (7 credits, wait if needed)
│ ├── Batch call 2: all pairs @ H1 (7 credits, wait if needed)
│ ├── Batch call 3: all pairs @ D1 (7 credits, wait if needed)
│ └── Batch call 4: all pairs @ W1 (7 credits, wait if needed)
│ └── Batch call 3: all pairs @ D1 (7 credits, wait if needed)
│
└── 4 threads (one per TF), all reading from warm cache
└── 2 threads (M15 + H1), all reading from warm cache
│
└── per thread: SignalAggregator.analyze_all_pairs()
│