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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user