Alpha Vantage API Tutorial: Free Stock Data for Python Traders (2026)
A practical guide to Alpha Vantage's free stock data API — API key setup, Python code examples, 50+ technical indicators, rate limit strategies, and when to upgrade from the free tier.
Alpha Vantage is one of the most popular free financial data APIs, and for good reason: you can pull stock quotes, historical OHLCV data, and 50+ pre-computed technical indicators with nothing more than a free API key and a few lines of Python. But the free tier has hard limits that will bite you if you do not plan around them. This guide walks through everything from initial setup to production-ready code patterns, with honest coverage of where Alpha Vantage works well and where you will hit walls.
What Is Alpha Vantage?
Alpha Vantage is a REST API that provides real-time and historical market data for stocks, forex, crypto, commodities, and economic indicators. Founded in 2017 and based in Boston, it has become the default starting point for developers and quants who need programmatic market data without enterprise-grade pricing. The API returns data in JSON or CSV format, which makes integration straightforward in any language.
The platform covers three main data categories: time series data (daily, weekly, monthly, and intraday OHLCV bars), technical indicators (50+ pre-computed studies including SMA, EMA, RSI, MACD, Bollinger Bands, and VWAP), and fundamental data (earnings, income statements, balance sheets, and cash flow statements). There is also a news sentiment endpoint that runs NLP on financial news articles — useful for sentiment-driven trading strategies.
You can read our full Alpha Vantage review for a broader assessment of the platform's strengths and weaknesses. This article focuses specifically on the practical side: getting data into your Python code and building something useful with it.
Getting Your Free API Key
Sign up at alphavantage.co/support/#api-key. You will get a key instantly — no credit card, no approval process. The free key gives you 25 API requests per day. That is the single most important number in this guide. Every endpoint call — whether you are fetching a stock quote, a technical indicator, or fundamental data — counts as one request.
Twenty-five requests per day is enough to:
- Pull daily OHLCV data for 10-15 stocks
- Compute a few technical indicators on a watchlist
- Run a basic screening routine once per day
It is not enough to:
- Build a real-time dashboard
- Backtest strategies across hundreds of symbols
- Run any kind of production application
If you need more, the Standard plan at $49.99/month gives you 75 requests per minute — a massive jump. The Premium plan at $99.99/month bumps that to 150/minute, and Enterprise at $249.99/month gets you 1,200/minute with SLA guarantees.
Python Setup and Your First API Call
You do not need a dedicated library to use Alpha Vantage — the requests library is all you need. That said, there is an official alpha_vantage Python wrapper that adds convenience methods. Here is the raw approach, which gives you full control:
import requests
import pandas as pd
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://www.alphavantage.co/query'
def get_daily_prices(symbol, outputsize='compact'):
params = {
'function': 'TIME_SERIES_DAILY',
'symbol': symbol,
'outputsize': outputsize,
'apikey': API_KEY
}
response = requests.get(BASE_URL, params=params)
data = response.json()
ts = data.get('Time Series (Daily)', {})
df = pd.DataFrame.from_dict(ts, orient='index')
df.index = pd.to_datetime(df.index)
df = df.astype(float)
df.columns = ['open', 'high', 'low', 'close', 'volume']
return df.sort_index()
# Example: Get AAPL daily prices
aapl = get_daily_prices('AAPL')
print(aapl.tail())The outputsize parameter matters: 'compact' returns the last 100 data points, 'full' returns 20+ years of history. Both count as a single API call, so always use 'full' when you need historical data — there is no penalty for pulling more data per request.
Using the 50+ Technical Indicators
Alpha Vantage pre-computes over 50 technical indicators server-side, which saves you the trouble of calculating them yourself. This is genuinely useful when you want indicator values without importing ta-lib or writing your own calculations. Here is how to fetch RSI:
def get_rsi(symbol, interval='daily', time_period=14, series_type='close'):
params = {
'function': 'RSI',
'symbol': symbol,
'interval': interval,
'time_period': time_period,
'series_type': series_type,
'apikey': API_KEY
}
response = requests.get(BASE_URL, params=params)
data = response.json()
rsi_data = data.get('Technical Analysis: RSI', {})
df = pd.DataFrame.from_dict(rsi_data, orient='index')
df.index = pd.to_datetime(df.index)
df = df.astype(float)
return df.sort_index()
rsi = get_rsi('AAPL')
print(rsi.tail())Available indicators include SMA, EMA, WMA, DEMA, TEMA, TRIMA, KAMA, T3, RSI, STOCH, STOCHF, MACD, ADX, CCI, AROON, BBANDS, AD, OBV, ATR, VWAP, and many more. The full list is documented in the API reference. Each indicator call counts as one request against your daily limit.
Rate Limit Strategies for the Free Tier
With only 25 calls per day on the free tier, you need to be strategic. Here are practical approaches:
1. Cache Everything Locally
Never fetch the same data twice. Store API responses in SQLite or CSV files with timestamps, and only re-fetch when data is stale:
import os
import json
from datetime import datetime, timedelta
CACHE_DIR = './av_cache'
os.makedirs(CACHE_DIR, exist_ok=True)
def cached_fetch(symbol, function, max_age_hours=24):
cache_file = f"{CACHE_DIR}/{symbol}_{function}.json"
if os.path.exists(cache_file):
modified = datetime.fromtimestamp(os.path.getmtime(cache_file))
if datetime.now() - modified < timedelta(hours=max_age_hours):
with open(cache_file) as f:
return json.load(f)
# Fetch from API if cache is stale
params = {'function': function, 'symbol': symbol, 'apikey': API_KEY}
response = requests.get(BASE_URL, params=params)
data = response.json()
with open(cache_file, 'w') as f:
json.dump(data, f)
return data2. Use Full Output Size
When you request outputsize=full, you get 20+ years of daily data in a single API call. Pull once, store locally, then only fetch recent data to update.
3. Batch Your Requests
Plan your daily 25 calls. If you track a 10-stock watchlist, dedicate 10 calls to price data and 10 to a single indicator (e.g., RSI), saving 5 calls for ad hoc queries.
4. Calculate Indicators Locally
Instead of burning API calls on pre-computed indicators, fetch raw OHLCV data and compute indicators yourself using pandas or ta-lib. One price data call can give you every indicator you need for that symbol.
Intraday Data: What the Free Tier Actually Gets You
Alpha Vantage supports intraday data at 1-minute, 5-minute, 15-minute, 30-minute, and 60-minute intervals. On the free tier, you get the latest 100 data points (roughly the last trading day at 1-minute resolution). The outputsize=full option extends this to 30 days of intraday history — again, as a single API call.
The catch: intraday data on the free tier is delayed by 15 minutes for US equities. Real-time intraday data requires a paid plan. For backtesting purposes the delay does not matter, but for any kind of live trading or real-time alerting, you will need at minimum the Standard plan at $49.99/month.
Alpha Vantage vs. Polygon.io: Which API Should You Choose?
The most common comparison is between Alpha Vantage and Polygon.io. Here is the honest breakdown:
| Feature | Alpha Vantage | Polygon.io |
|---|---|---|
| Free tier | 25 requests/day | 5 requests/minute (delayed) |
| Paid starting price | $49.99/month | $29/month |
| WebSocket streaming | No | Yes (Developer plan+) |
| Tick-level data | No | Yes |
| Pre-computed indicators | 50+ | No |
| Real-time data | Paid plans only | $79/month+ |
| API style | Simple REST | REST + WebSocket |
Alpha Vantage wins on simplicity and the built-in indicator library. Polygon.io wins on real-time performance, WebSocket streaming, and tick-level granularity. For a deeper look at these tradeoffs, see our Alpha Vantage vs. Polygon.io comparison.
If you are building a prototype, learning Python for finance, or running end-of-day strategies, Alpha Vantage is the easier starting point. If you need real-time streaming, millisecond timestamps, or options data, Polygon.io is the better foundation even though the entry price is lower — the free tier's rate-per-minute model is more practical than Alpha Vantage's per-day model for interactive use.
AI and LLM Integration
Alpha Vantage has leaned heavily into the AI/ML space, positioning itself as a data source for large language model applications. The API integrates with LangChain, LlamaIndex, and other LLM frameworks, making it straightforward to build AI agents that can pull live market data into their context window.
For quantitative researchers, the combination of pre-computed technical indicators plus fundamental data in a single API makes Alpha Vantage a practical choice for feature engineering in machine learning pipelines. You can pull RSI, MACD, Bollinger Band values, earnings data, and price history from a single source without normalizing data from multiple providers.
Real Use Cases That Work on the Free Tier
Daily Watchlist Scanner
Use 15 of your 25 daily calls to fetch prices for a focused watchlist. Compute indicators locally. Flag stocks meeting your criteria. This runs once per day via a cron job or scheduled task.
Earnings Calendar Tracker
Use the Earnings Calendar endpoint to pull upcoming earnings dates, then fetch fundamental data for companies reporting this week. Useful for swing traders who position around earnings.
Portfolio Performance Monitor
If you hold 5-8 positions, use daily calls to pull current prices and compute unrealized P&L. Store results in a simple SQLite database and generate weekly performance charts with matplotlib.
Economic Indicator Dashboard
Alpha Vantage provides macroeconomic data — GDP, CPI, inflation rates, federal funds rate, unemployment — that does not change daily. Fetch these weekly and build a macro dashboard that updates on a schedule.
Common Pitfalls and How to Avoid Them
- Not handling rate limits gracefully. Always check the response for error messages. Alpha Vantage returns a polite JSON message when you exceed limits rather than an HTTP error code, so your code may silently process an error response as data. Parse defensively.
- Assuming real-time data on the free tier. Free tier equity data is delayed 15 minutes. Do not build trading signals around it without understanding this latency.
- Ignoring data gaps. Some users report occasional missing data points or discrepancies in adjusted close prices. Cross-validate critical data against a second source, especially for backtesting.
- Calling the API in a tight loop. Even on paid plans, hammering the API without
time.sleep()between calls will trigger rate limiting. Space your requests by at least 1 second.
When to Upgrade from the Free Tier
The free tier is adequate for learning, prototyping, and running small personal projects. You should upgrade when:
- You need to scan more than 25 symbols per day
- You require real-time data for intraday trading signals
- You are building an application that other people will use
- You need reliability guarantees (the free tier has no SLA)
The Standard plan at $49.99/month is the sweet spot for most individual traders and small projects. The jump from 25 requests/day to 75 requests/minute is enormous — effectively unlimited for most personal use cases. Reserve Premium ($99.99/month) and Enterprise ($249.99/month) for production applications with real users.
For a broader view of how Alpha Vantage stacks up against the full landscape of market data APIs, see our comparisons: Alpha Vantage vs. Bloomberg Terminal and Alpha Vantage vs. Refinitiv Eikon — though those comparisons make clear that Alpha Vantage and institutional terminals serve fundamentally different audiences.
Pairing Alpha Vantage Data with Charting Tools
Alpha Vantage is a data source, not a charting platform. Once you have data flowing, you will likely want to visualize it. TradingView supports custom data integrations through its charting library, and many developers use Alpha Vantage as the backend data feed for TradingView-style chart components in their own applications.
For Python-native visualization, matplotlib and plotly handle most charting needs. The mplfinance library is specifically designed for candlestick charts with volume overlays and indicator plotting — pair it with Alpha Vantage data for a lightweight but capable charting setup entirely within Python.
Bottom Line
Alpha Vantage remains the most accessible entry point for developers who want programmatic stock data without paying upfront. The free tier is genuinely useful for learning and prototyping — something that cannot be said for most financial data providers. The 50+ pre-computed technical indicators save significant development time, and the simple REST API means you can be pulling data within minutes of getting your key.
The limitations are real: 25 requests/day constrains any serious application, data quality is occasionally inconsistent, and the lack of WebSocket streaming makes it unsuitable for real-time use cases. But for Python traders building personal tools, testing strategies against historical data, or learning quantitative finance, Alpha Vantage delivers genuine value at zero cost. Start with the free tier, build something that works, and upgrade only when the rate limits actually become the bottleneck.