Add CLAUDE.md with two known bugs
Bug 1: concurrent TF scans exhaust free-tier API credits (8/min limit) Bug 2: XAUUSD synthetic fallback uses wrong base price (~1.0 vs ~3300) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# ForexBot2 — Known Bugs & Dev Notes
|
||||
|
||||
## Bug 1 — Concurrent TF scans exhaust API credits instantly
|
||||
|
||||
**Symptom:**
|
||||
```
|
||||
Batch prefetch failed for 1wk: You have run out of API credits for the current minute.
|
||||
9 API credits were used, with the current limit at https://twelvedata.com/pricing
|
||||
```
|
||||
Warnings appear for every timeframe (1h, 4h, 1d, 1wk) in rapid succession.
|
||||
|
||||
**Root cause:**
|
||||
`telegram_bot.py` runs all 4 `SCAN_TIMEFRAMES` concurrently via `ThreadPoolExecutor`.
|
||||
Each `SignalAggregator` fires its own batch prefetch simultaneously.
|
||||
Free tier limit is **8 credits/minute** — 4 parallel scans hit this in under a second.
|
||||
|
||||
**Impact:**
|
||||
Confirmation timeframes fail and fall back to synthetic data.
|
||||
Primary TF still has real data (first request wins the credits).
|
||||
|
||||
**Fix (not yet implemented):**
|
||||
Run timeframes sequentially with a 60-second wait between each, or reduce
|
||||
`SCAN_TIMEFRAMES` to a single primary TF and use the engine's built-in
|
||||
multi-timeframe confirmation (which already batches efficiently in 3 calls).
|
||||
|
||||
---
|
||||
|
||||
## Bug 2 — XAUUSD (Gold) shows wrong price (~1.01 instead of ~3300)
|
||||
|
||||
**Symptom:**
|
||||
```
|
||||
Entry: 1.01037
|
||||
Take Profit: 1.00767 (+0.3 pips)
|
||||
Stop Loss: 1.01172 (-0.1 pips)
|
||||
```
|
||||
|
||||
**Root cause:**
|
||||
Two compounding issues:
|
||||
|
||||
1. XAUUSD is not available on the Twelve Data **free tier** — API returns no data.
|
||||
2. `data_provider._generate_synthetic_data()` uses a `pair_params` dict for base
|
||||
prices. XAUUSD either falls through to a wrong default (~1.0) instead of the
|
||||
correct ~3300 baseline.
|
||||
|
||||
Check `data_provider.py` → `_generate_synthetic_data()` → `pair_params` dict.
|
||||
Verify `"XAUUSD=X"` has a correct `"price"` entry around `3300.0`.
|
||||
|
||||
**Impact:**
|
||||
All indicator values, entry, TP, and SL for XAUUSD are meaningless when
|
||||
running on the free tier (synthetic data with wrong base price).
|
||||
|
||||
**Fix (not yet implemented):**
|
||||
- Correct the base price in `pair_params` for `XAUUSD=X`.
|
||||
- Add a bot-level guard: if `report.current_price < 100` for XAUUSD,
|
||||
suppress the trade setup and show a "data unavailable" message instead.
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- Free tier: 8 credits/min, 800 credits/day. Each full scan = ~21 credits.
|
||||
- Supported pairs (live data on free tier): EURUSD, GBPUSD, USDJPY, USDCHF,
|
||||
AUDUSD, USDCAD, NZDUSD, EURGBP, EURJPY, GBPJPY, AUDJPY, EURCHF, CADJPY.
|
||||
- All other symbols (XAU, XAG, commodities, indices) fall back to synthetic GBM data.
|
||||
Reference in New Issue
Block a user