Expand description
External financial data source adapters.
Each adapter is behind a feature flag and follows the same pattern:
-
Enable the feature in
Cargo.toml:[dependencies] finance-query = { version = "2.4", features = ["polygon"] } -
Initialize once at startup with your API key:
finance_query::adapters::polygon::init("YOUR_KEY").unwrap(); -
Call any endpoint — all functions are async:
use finance_query::adapters::polygon::{self, Timespan}; let bars = polygon::stock_aggregates("AAPL", 1, Timespan::Day, "2024-01-01", "2024-12-31", None).await?;
§Available adapters
| Feature | Provider | Free tier | Endpoints | Coverage |
|---|---|---|---|---|
alphavantage | Alpha Vantage | 25 req/day | ~100 | Stocks, forex, crypto, commodities, economic indicators, 50+ technical indicators |
polygon | Polygon.io | 5 req/sec | ~100 | Stocks, options, forex, crypto, indices, futures, economy, analyst data, WebSocket streaming |
fmp | Financial Modeling Prep | 250 req/day | ~100 | Fundamentals, DCF/ratings, insider trading, institutional holdings, screener, 60+ exchanges |
§Quick comparison
- Alpha Vantage: Best free option for technical indicators (50+) and economic data. Lowest rate limits.
- Polygon.io: Tick-level trades/quotes, SEC filings, real-time WebSocket streams. Best for market microstructure.
- FMP: Deepest fundamentals coverage (as-reported financials, DCF, ratings, analyst estimates, earnings transcripts). Best for fundamental analysis.
All adapters share:
- Singleton pattern with
init(api_key)/init_with_timeout(api_key, timeout) - Built-in rate limiting via shared token-bucket limiter
- Error mapping to
crate::FinanceErrorvariants - Full mockito test coverage (no API key needed to run tests)
Modules§
- alphavantage
- Alpha Vantage financial data API (requires
alphavantagefeature). Alpha Vantage API client for financial data. - fmp
- Financial Modeling Prep (FMP) financial data API (requires
fmpfeature). Financial Modeling Prep API client for financial data. - polygon
- Polygon.io financial data API (requires
polygonfeature). Polygon.io API client for financial data.