The `alpha-vantage` library is a Python wrapper for the Alpha Vantage API, providing access to real-time and historical financial data, including stocks, cryptocurrencies, technical indicators, and economic data. The library is actively maintained, with the current version being 3.0.0, and receives regular updates.
pip install alpha-vantageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `TimeSeries` object with an API key (preferably from an environment variable) and fetch daily adjusted stock data and a real-time global quote, displaying the output using pandas DataFrames. Ensure you have `pandas` installed for DataFrame output.
Implement proper rate limiting and exponential backoff in your code. For higher call volumes, consider a premium Alpha Vantage plan. Store your API key as an environment variable (ALPHAVANTAGE_API_KEY) to avoid hardcoding.
Review the official Alpha Vantage API documentation for updated endpoints and alternative data sources if your application relies on these deprecated features. Adjust your code to use new or existing supported functions.
For free API keys, use `outputsize='compact'` which returns the latest 100 data points. To access full historical data, a premium Alpha Vantage membership is required.
Update your code to account for the exact column names returned by the API. If migrating old code, verify the expected column names in your data processing logic.
Double-check the symbol and parameters against the Alpha Vantage API documentation. Ensure your API key supports the requested feature. For historical data, try `outputsize='compact'` if using a free key. Confirm the API key is correctly provided to the library.
Verify your API key is correct and active. Check the symbol for typos or if it's supported by Alpha Vantage. Ensure you are not exceeding the API call limits (5 calls/minute for free tier). Inspect the raw JSON response if possible to diagnose the missing key.
Obtain a new API key from the Alpha Vantage website. Double-check that the API key is copied and pasted correctly without extra spaces or characters. Ensure it's correctly passed to the `TimeSeries` (or other client) constructor, or set as the `ALPHAVANTAGE_API_KEY` environment variable.