Vendor Setup
CRITERION Vendor Data Source Setup
Section titled “CRITERION Vendor Data Source Setup”This document explains how to configure Yahoo Finance and Alpha Vantage as market data sources for CRITERION.
Yahoo Finance
Section titled “Yahoo Finance”- Cost: Free
- API Key: Not required
- Rate Limits: CRITERION enforces approximately 48 requests per hour by default (configurable).
Configuration example (YAML):
data_source: source_type: yahoo source_params: requests_per_hour: 48 # optional, default 48Notes:
- Data is split-adjusted and dividend-adjusted.
- Historical data only; suitable for daily backtesting.
- No API key or registration required.
Alpha Vantage
Section titled “Alpha Vantage”- Cost: Free tier available
- API Key: Required
- Rate Limits: Free tier: 5 calls per minute, 500 calls per day (CRITERION defaults match these).
Setup:
- Register at Alpha Vantage and obtain an API key.
- Prefer storing the key in an environment variable and passing it via config (e.g. from env) rather than hardcoding.
Configuration example (YAML):
data_source: source_type: alphavantage source_params: api_key: ${ALPHAVANTAGE_API_KEY} # required requests_per_minute: 5 # optional, default 5 requests_per_day: 500 # optional, default 500Notes:
- Data is split-adjusted only (no dividend adjustment in daily series).
- Daily data; suitable for daily backtesting.
Rate Limit Warnings
Section titled “Rate Limit Warnings”CRITERION strictly enforces rate limits. Rate limiting is preemptive: the limit is checked before each network request. If the limit would be exceeded, a DataSourceError is raised and no request is made. There are no automatic retries on rate limit errors.
- Plan backtests and data usage to stay within limits.
- Use the cache (Stage 16.2) to avoid repeated requests for the same data.
Troubleshooting
Section titled “Troubleshooting”| Issue | Suggestions |
|---|---|
| Rate limit exceeded | Wait for the sliding window to reset; reduce request rate; use cache. |
| SOURCE_UNREACHABLE | Check network connectivity; verify the service is up; for Alpha Vantage, verify API key. |
| MISSING_DATA | Verify the symbol is valid; check the date range; note that some symbols have limited history. |