Add Telegram bot and fix excessive API calls

- Add telegram_bot.py: full bot interface with /scan, /signals, /pair,
  /all, /tf, /watch, /unwatch, /status, /help commands; per-chat state;
  background thread pool for analysis; auto message splitting
- Fix data_provider: warn once per symbol with no API data and cache
  synthetic fallback to prevent redundant individual API calls
- Fix signal_aggregator: derive spread estimate from already-fetched
  primary DataFrame instead of making a separate M5 API call per pair
- Add python-telegram-bot[job-queue]>=20.0 to requirements.txt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Harwinder
2026-05-04 15:15:04 -04:00
parent bc1844b233
commit 71c3fb6d82
4 changed files with 609 additions and 2 deletions
+5 -1
View File
@@ -202,7 +202,11 @@ class SignalAggregator:
report.news_description = sent_desc
# ── 5. Spread Estimate ─────────────────────────────────────
report.spread_estimate = self.data_provider.get_spread_estimate(symbol)
# Derive spread from already-fetched primary_df to avoid a separate M5 API call
if primary_df is not None and not primary_df.empty:
report.spread_estimate = float((primary_df["High"] - primary_df["Low"]).median())
else:
report.spread_estimate = self.data_provider.get_spread_estimate(symbol)
# ── 6. Compute Final Signal ────────────────────────────────
self._compute_final_signal(report)