Commit Graph

2 Commits

Author SHA1 Message Date
Harwinder b124d0a7a3 Handle Finnhub 403; make exchange prefix configurable
OANDA forex candles require a paid plan — free-tier keys get 403.

- Add FINNHUB_FOREX_EXCHANGE env var (default OANDA) so the exchange
  prefix can be changed without touching code
- Handle 403 specifically: clear error message tells the user which
  exchange failed and how to discover what their key can access
- Add discover_exchanges() method wrapping forex_exchanges() API call
  so the right prefix can be found before configuring the bot

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:26:10 -04:00
Harwinder 43cc4bdd42 Switch data source to Finnhub API; remove synthetic data fallback
Adds FinnhubDataProvider as a drop-in replacement for ForexDataProvider.
Rate limit or API errors raise DataUnavailableError immediately — the
Telegram bot shows a clean per-TF error card rather than fake prices.

- data_provider_finnhub.py: Finnhub client, OANDA symbol mapping,
  4h resampled from 60-min candles, shared module-level rate limiter
  (60 calls/min free tier), full OHLCV validation copied from original
- signal_aggregator.py: import FinnhubDataProvider alias ForexDataProvider
- config.py: add finnhub_api_key field (FINNHUB_API_KEY env var overrides)
- telegram_bot.py: remove synthetic-data warning and _SUPPORTED_PAIRS;
  unsupported pairs now show the engine's "data unavailable" card
- requirements.txt: add finnhub-python>=1.0

Set FINNHUB_API_KEY env var before running. main branch is untouched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 20:12:41 -04:00