diff --git a/telegram_bot.py b/telegram_bot.py index 8fd324e..a639d97 100644 --- a/telegram_bot.py +++ b/telegram_bot.py @@ -274,6 +274,10 @@ class ForexTelegramBot: self._executor = ThreadPoolExecutor( max_workers=len(SCAN_TIMEFRAMES), thread_name_prefix="forex" ) + # Persistent ForexDataProvider so the OHLCV cache survives across + # /scan and /signal calls. Without this each call burns API credits + # re-fetching the same bars and waits up to 60s on the rate limit. + self._provider = ForexDataProvider(PlatformConfig()) # ── Engine helpers ──────────────────────────────────────────────── @@ -297,7 +301,7 @@ class ForexTelegramBot: for tf_name in SCAN_TIMEFRAMES for tf in [_TF_MAP[tf_name]] + _TF_CONFIRMATIONS.get(tf_name, []) }) - provider = ForexDataProvider(PlatformConfig()) + provider = self._provider # reuse across calls — see __init__ loop = asyncio.get_running_loop() if progress: