Data Sources
APIs and data providers for weekly trading strategies, including price data, earnings, and fundamentals.
Price Data APIs
Free Sources
Yahoo Finance (yfinance)
- Historical OHLCV data
- Python library:
pip install yfinance - Usage:
yf.download("AAPL", period="1y", interval="1wk") - Limitations: Rate limits, occasional data gaps
Alpha Vantage
- Free tier with API key (500 calls/day)
- Weekly adjusted data
- Endpoint:
TIME_SERIES_WEEKLY_ADJUSTED - alphavantage.co
Paid/Professional Sources
Polygon.io
- Real-time and historical data
- WebSocket streaming
- Aggregated bars (weekly supported)
- polygon.io
IEX Cloud
- US market data
- Historical and intraday
- Sandbox environment for testing
- iexcloud.io
Quandl (Nasdaq Data Link)
- End-of-day and fundamentals
- Premium datasets
- data.nasdaq.com
Earnings & Event Data
Free Sources
Yahoo Finance (yfinance)
- Fetch earnings dates and EPS estimates via Python
- Limitations: Not always complete or real-time
- API:
yf.Ticker("SYMBOL").earnings_dates
Finnhub.io
- Free tier with API key
- Earnings calendar, actual vs. estimated EPS, surprise data
- Endpoint:
/calendar/earnings - finnhub.io
Alpha Vantage
- Earnings data via API (limited in free tier)
- Endpoint:
EARNINGS
Paid/Professional Sources
IEX Cloud
- Actual vs. estimate and surprise data
- Paid tiers: Historical depth + real-time access
Polygon.io
- High-quality earnings data
- Pre/post-market reactions
- Earnings calendar + financials
Quandl (Nasdaq Data Link)
- Earnings and fundamental data
- Premium institutional-grade datasets
Fundamental Data
Financial Modeling Prep
- Balance sheets, income statements, cash flow
- Financial ratios and metrics
- Free tier available
- financialmodelingprep.com
Intrinio
- Fundamental and alternative data
- Developer-friendly API
- intrinio.com
SEC EDGAR
- Official company filings (10-K, 10-Q, 8-K)
- Free, comprehensive, no API key required
- sec.gov/edgar
Alternative Data
News & Sentiment
- News API - News headlines and sources
- Benzinga - Real-time news and sentiment
- MarketPsych - Sentiment indicators
Social Media
- Twitter API - Track mentions and sentiment
- Reddit API - Track discussions (e.g., r/stocks, r/investing)
- StockTwits - Social sentiment for stocks
Best Practices
For Prototyping & Backtesting
- Start with free APIs (Yahoo Finance, Finnhub, Alpha Vantage)
- Validate data quality against multiple sources
- Cache data locally to avoid rate limits
For Production Trading
Upgrade to paid APIs when you need:
- Real-time data - Intraday prices, streaming quotes
- High reliability - SLAs, guaranteed uptime
- Historical depth - Years of clean, adjusted data
- Advanced features - Corporate actions, splits, dividends
- Higher limits - More API calls, faster rate limits
Data Quality Checklist
- [ ] Adjusted for splits and dividends
- [ ] Volume data included
- [ ] Missing data handled (gaps, holidays)
- [ ] Timezone consistency (market hours vs. UTC)
- [ ] Historical accuracy verified against multiple sources
API Integration Notes
Rate Limiting
- Implement exponential backoff for retries
- Cache responses to minimize redundant calls
- Use bulk endpoints when available
Error Handling
- Handle network timeouts gracefully
- Validate response data before processing
- Log failed requests for debugging
Data Storage
- Store raw data for audit trail
- Normalize to common format (e.g., OHLCV dataframe)
- Consider using Parquet for efficient storage
Related Documentation
- Overview - Weekly trading concepts and strategy types
- Stock Selection - Selection criteria and sector rotation
- Tools & Screeners - Screener setup and analysis tools
- Strategy Template - Template for documenting strategies