Your code probably has a line like this:
data["Time Series (Daily)"][day]["4. close"]
It reads a string from a numbered key inside a date-keyed object. After the switch, you’ll read a number from a flat array.
Many teams look at Alpha Vantage alternatives when they mainly call daily and intraday prices. If that’s how you use the Alpha Vantage API, moving to marketstack is mostly a URL, a key name and a field map. Here’s the code, a parity test and a cut-over checklist.
Table of Contents
Why Teams Switch From Alpha Vantage (and When to Stay)
For a feature and pricing comparison, see marketstack vs Alpha Vantage. This guide covers the code.
Teams move price data to marketstack for three reasons:
- Monthly quotas with commercial use from the $9.99 Starter plan.
- Raw and adjusted OHLCV in the same EOD row, in a flat JSON array that drops straight into pandas.
- Non-US listings by symbol plus MIC exchange code.
Alpha Vantage remains the better fit for some work, per its documentation and premium page:
- Technical indicators (SMA, EMA, RSI, MACD), NEWS_SENTIMENT and options (HISTORICAL_OPTIONS).
- FX (FX_DAILY) and crypto (DIGITAL_CURRENCY_DAILY).
- 25+ years of daily history and no daily limits on premium keys.
marketstack doesn’t offer those functions, so keep a second source if you depend on them.
What are the best alternatives to Alpha Vantage? It depends on the functions you call. For daily and intraday prices, marketstack is a strong fit; for indicators and news, Alpha Vantage remains useful.
Alpha Vantage alternative: what should you look for? List every function= value in your code, then pick the provider that covers them.
marketstack vs Alpha Vantage: which is better? Neither wins every job. marketstack suits price data; Alpha Vantage suits indicators and news.
What Changes: the Alpha Vantage to marketstack Mapping
To switch from Alpha Vantage to marketstack, replace function=TIME_SERIES_DAILY calls with GET https://api.apilayer.net/marketstack/v2/eod, send your key as access_key instead of apikey, read prices from the flat data array instead of the date-keyed object, and use the adj_ fields for adjusted prices.
The Alpha Vantage API uses one URL with a function parameter; marketstack uses one endpoint per task. The base URL is https://api.apilayer.net/marketstack/v2, and your access_key is in the APILayer dashboard (app.apilayer.com).
Function-to-endpoint map
Alpha Vantage function | marketstack v2 endpoint | Notes |
|---|---|---|
TIME_SERIES_DAILY | GET /v2/eod | Raw open, high, low, close, volume |
TIME_SERIES_DAILY_ADJUSTED | GET /v2/eod | Same row adds adj_ fields, split_factor and dividend |
TIME_SERIES_INTRADAY | GET /v2/intraday | Set interval |
GLOBAL_QUOTE | GET /v2/eod/latest or GET /v2/stockprice | Last close, or real-time price (Professional and above) |
SYMBOL_SEARCH | GET /v2/tickerslist?search=… | |
OVERVIEW | GET /v2/tickerinfo?ticker=… | Sector, industry, description |
DIVIDENDS, SPLITS | GET /v2/dividends, GET /v2/splits | Also per symbol |
INCOME_STATEMENT, BALANCE_SHEET, CASH_FLOW | No direct equivalent | Closest: GET /v2/company_facts (SEC XBRL), selected plans |
TIME_SERIES_WEEKLY, TIME_SERIES_MONTHLY | None listed | Resample daily bars: df.resample(“W-FRI”) |
Indicators, news, options, FX, crypto | None | Compute from adj_close, or keep a second source |
What’s the best REST API for stock quotes? For end-of-day quotes in JSON, marketstack’s /v2/eod/latest returns the latest close.
Which API gives real-time stock prices in JSON format? marketstack’s /v2/stockprice, on Professional and above.
Response shape: from date-keyed objects to a flat data array
A trimmed TIME_SERIES_DAILY response for IBM, using the demo key (30 Nov 2026):
{
"Meta Data": { "2. Symbol": "IBM", "5. Time Zone": "US/Eastern" },
"Time Series (Daily)": {
"2026-11-30": { "1. open": "247.0000", "4. close": "245.2400", "5. volume": "9357782" }
}
}
Every value is a string. In TIME_SERIES_DAILY_ADJUSTED the row has eight keys and volume moves from “5. volume” to “6. volume”, a common parser bug.
marketstack’s /v2/eod returns pagination (limit, offset, count, total) and a data array. Each row holds numbers: open, high, low, close, volume, the adj_ fields, split_factor and dividend, plus name, exchange_code, asset_type, price_currency, symbol, exchange and an ISO 8601 date.
Alpha Vantage | marketstack |
|---|---|
“1. open”, “2. high”, “3. low”, “4. close” | open, high, low, close |
“5. adjusted close” | adj_close |
“5. volume” (daily) or “6. volume” (adjusted) | volume |
“7. dividend amount” | dividend |
“8. split coefficient” | split_factor |
Date key | date |
“2. Symbol” (once, in Meta Data) | symbol (on every row) |
marketstack also adds adj_open, adj_high, adj_low, adj_volume and price_currency; Alpha Vantage’s adjusted daily series has only an adjusted close.
Symbols, exchanges and coverage
Alpha Vantage uses suffixes for non-US listings: TSCO.LON, SHOP.TRT, MBG.DEX, RELIANCE.BSE, 600104.SHH. marketstack uses the ticker plus a MIC exchange code (XNAS, XLON) in the exchange parameter, and lists tickers with /v2/exchanges/{mic}/tickers or /v2/tickerslist?exchange=XLON.
Don’t hard-code a suffix rule. Build a lookup table from the tickers endpoints and confirm each symbol with a test call; see how to find and validate stock ticker symbols. Two details:
- Periods become hyphens: BRK.B is BRK-B.
- Many LSE stocks are quoted in pence (GBX); GBP = GBX / 100. Check price_currency before you compare.
Prerequisites: Pick a Plan and Get Your Key
marketstack plans, from the product page:
Plan | Price | Requests | History |
|---|---|---|---|
Free | $0 | 100/month | 1 year |
Starter | $9.99/month | 10,000/month | 10 years |
Professional | $49.99/month | 100,000/month | 15+ years |
Enterprise | $149.99/month | 500,000/month | 15+ years |
Custom | Contact sales | Custom | Custom |
Free is end-of-day data only, for non-commercial use. Starter adds commercial use and US intraday data, Professional adds real-time prices, and Enterprise adds company data such as financial statements. Details are on the marketstack pricing plans page (checked 1 Dec 2026).
Alpha Vantage’s free tier allows 25 requests a day. Premium is sold by requests per minute: 75 for $49.99, 150 for $99.99, 300 for $149.99, 600 for $199.99 and 1,200 for $249.99 a month, with no daily limits and two months off on annual plans (checked 1 Dec 2026). The $49.99 plan includes 15-minute delayed US market data; $99.99 and above include real-time US data.
The units differ: Alpha Vantage sells requests per minute (or per day on free), and marketstack sells requests per month, with a rate limit of 5 requests a second. On Alpha Vantage, outputsize=full and TIME_SERIES_DAILY_ADJUSTED are premium; on marketstack the adjusted fields come in every EOD row. When you compare a historical stock data API, match each plan’s lookback to yours.
Before you choose, check: your longest lookback, symbols × refreshes per month, commercial use, whether you need intervals under 15 minutes, and which company data you need. Then get a free marketstack API key for test calls; Free allows 100 requests a month, so keep tests small. Weighing Polygon.io too? Read marketstack vs Alpha Vantage vs Polygon.io.
How does marketstack pricing compare to Alpha Vantage and Polygon.io? Alpha Vantage charges per minute; marketstack by monthly quota, from $9.99 for 10,000 requests. The three-way post covers Polygon.io.
What should I consider when choosing a stock market data API for my startup? Estimate monthly requests, confirm commercial use, and check that the history on your plan covers your lookback.
I’m a head of research in the hedge fund space. What’s the most affordable way to integrate a stock market data API? Cache end-of-day bars and fetch only new days. 1,000 symbols once a day is about 30,000 requests a month, which fits Professional.
Step-by-Step: Migrate Your Alpha Vantage Code
Step 1: Move the key and base URL into config
Alpha Vantage: https://www.alphavantage.co/query with apikey. marketstack: https://api.apilayer.net/marketstack/v2 with access_key. Both use HTTPS, and marketstack supports it on all plans.
Keep calls on the server so the key never ships to a browser, and put both providers behind one get_daily_bars(symbol, start, end) function. The cut-over then becomes a config switch.
Step 2: Replace TIME_SERIES_DAILY with /v2/eod
/v2/eod returns eod data for one or more symbols.
# Before
curl "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=YOUR_API_KEY"
# After
curl "https://api.apilayer.net/marketstack/v2/eod?access_key=YOUR_ACCESS_KEY&symbols=IBM&date_from=2026-01-01&date_to=2026-11-11&limit=1000"
Before (Python):
import requests
r = requests.get("https://www.alphavantage.co/query", params={
"function": "TIME_SERIES_DAILY", "symbol": "IBM", "apikey": AV_KEY})
series = r.json()["Time Series (Daily)"]
bars = [{"date": d, "close": float(v["4. close"])} for d, v in series.items()]
After:
import os, requests
BASE = "https://api.apilayer.net/marketstack/v2"
KEY = os.environ["MARKETSTACK_KEY"]
r = requests.get(f"{BASE}/eod", params={
"access_key": KEY, "symbols": "IBM", "date_from": "2026-01-01",
"date_to": "2026-11-11", "sort": "ASC", "limit": 1000}, timeout=30)
bars = [{"date": row["date"][:10], "close": row["close"]} for row in r.json()["data"]]
See the marketstack API documentation for every parameter. The ones you’ll use:
- symbols: required, comma-separated.
- date_from, date_to: YYYY-MM-DD.
- sort: DESC by default; ASC for oldest first.
- exchange: MIC code.
- limit: default 100, maximum 1,000. offset: for pagination.
outputsize=compact maps to limit=100. There’s no outputsize=full; use a date range and pagination.
Step 3: Paginate and fetch several symbols
TIME_SERIES_DAILY takes one symbol per call; /v2/eod takes symbols=AAPL,MSFT,IBM. Each symbol counts as one request, so a call with five tickers uses five, while errors don’t count against your quota. The reference doesn’t state a maximum number of symbols per request.
Rows for all symbols share one paginated result set, so page through it and group by symbol afterwards. This loop uses get_json() from Step 6 so errors are caught:
def fetch_eod(symbols, date_from, date_to, limit=1000):
rows, offset = [], 0
while True:
body = get_json(f"{BASE}/eod", {
"access_key": KEY, "symbols": symbols, "date_from": date_from,
"date_to": date_to, "limit": limit, "offset": offset})
rows += body["data"]
offset += limit
if offset >= body["pagination"]["total"]:
return rows
Step 4: Switch adjusted-price code to the adj_ fields
Replace “5. adjusted close” with adj_close, “7. dividend amount” with dividend and “8. split coefficient” with split_factor. If your code rebuilt adjusted OHLC from the split coefficient, delete it: marketstack returns adj_open, adj_high, adj_low, adj_close and adj_volume directly.
Step 5: Replace TIME_SERIES_INTRADAY with /v2/intraday
Alpha Vantage intervals are 1min, 5min, 15min, 30min and 60min, with adjusted=true by default, extended_hours and month. marketstack’s are 1min, 5min, 10min, 15min, 30min, 1hour (the default), 3hour, 6hour, 12hour and 24hour, plus after_hours. Map 60min to 1hour. As an intraday stock data API, marketstack covers US tickers via IEX.
Intraday isn’t on Free; US intraday starts on Starter. bid, ask, last and mid return NULL without IEX entitlement, so don’t build on them. See the marketstack intraday endpoint reference and how intraday stock data works.
Intraday stock data API: what is it? An API that returns price bars at intervals through the trading day. In marketstack, that’s /v2/intraday.
Data engineers at hedge funds want the most scalable way to get intraday price data for US tickers. What should they use? /v2/intraday with date ranges and pagination, the coarsest interval that meets the need, and a cache for every completed bar.
Step 6: Replace error handling
marketstack returns an error object instead of data. Handle 401 (unauthorized), 403 function_access_restricted (endpoint not on your plan), 422 (validation), 429 too_many_requests (monthly quota) and 429 rate_limit_reached (more than 5 requests a second), and retry 429 after a short delay. See marketstack error codes and rate limits.
import time
def get_json(url, params, tries=3):
for i in range(tries):
r = requests.get(url, params=params, timeout=30)
body = r.json()
if "error" not in body:
return body
if r.status_code == 429 and i < tries - 1:
time.sleep(2 ** i)
else:
err = body["error"]
raise RuntimeError(err.get("message") or err.get("info") or err.get("code"))
Delete Alpha Vantage checks for a missing time-series key, and check for the error object before reading data.
Handling the Differences That Break Parity
Adjusted prices
marketstack adjusts using the CRSP Calculations methodology from the Center for Research in Security Prices. Alpha Vantage describes TIME_SERIES_DAILY as raw (as-traded), and TIME_SERIES_DAILY_ADJUSTED adds an adjusted close and historical split and dividend events. Raw closes should match closely; adjusted values can differ by method, so compare them with a tolerance and compare daily returns, not just levels. For split and dividend history on its own, use /v2/splits and /v2/dividends.
Dates and timezones
Alpha Vantage daily keys are YYYY-MM-DD in US/Eastern, with regular hours of 9:30 a.m. to 4:00 p.m. ET. marketstack returns an ISO 8601 timestamp such as 2020-05-21T00:00:00+0000. For EOD, take row[“date”][:10] as the trading day. For intraday, convert the full timestamp to the exchange timezone (/v2/timezones and /v2/exchanges have the reference data). marketstack sorts DESC by default; set sort=ASC if your code expects oldest first.
Rate limits and quotas
marketstack allows up to 5 requests a second (HTTP 429 above that) and a monthly quota on paid plans. Cache EOD bars after the close, fetch only new days with date_from, and use /v2/eod/latest for the daily refresh. Example: 200 symbols once a day is about 200 requests a day, or 6,000 over 30 days, which fits Starter’s 10,000.
Stock market API pricing: how does it compare? Alpha Vantage prices by requests per minute; marketstack by monthly quota.
Test Parity on Sample Tickers Before You Cut Over
- Pick 10 to 20 of your tickers, including one recent split, one high-dividend stock and one non-US listing.
- Pull the same date range from both APIs on the same day.
- Compare raw close row by row and report the maximum absolute difference.
- Compare adj_close with a tolerance, and compare daily returns.
- Check missing dates (holidays, halts) on both sides.
- Check volume units and LSE pence.
import pandas as pd
av = pd.DataFrame(av_bars).set_index("date")
ms = pd.DataFrame(ms_bars).set_index("date")
j = av.join(ms, lsuffix="_av", rsuffix="_ms", how="outer")
d = (j["close_av"] - j["close_ms"]).abs()
print("Max diff:", d.max(), "Within 0.01:", (d <= 0.01).mean())
Free’s 100 requests a month (one per symbol per call) cover a small run on a few tickers. Note Free’s 1-year history limit, and use a paid plan for the full test.
Deployment Checklist
- ☐ Key in an environment variable or secret store
- ☐ Base URL pinned to /v2
- ☐ All response fields mapped
- ☐ Volume key bug fixed
- ☐ Pagination tested past 1,000 rows
- ☐ Error object handled and 429 retried
- ☐ Date parsing and sort order checked
- ☐ Symbol and MIC lookup table built
- ☐ Cache in place
- ☐ Dashboards and alerts updated
- ☐ Both providers run in parallel for a week behind a feature flag
- ☐ Alpha Vantage key removed after cut-over
Explore APILayer Products
Discover APIs for geolocation, finance, aviation, weather, web scraping, AI, and more. Browse APILayer's product catalog to find the right APIs for your application and integrate the data and functionality your project needs.
Explore APILayer ProductsFind the right tools to start building.
FAQs
Is marketstack a good Alpha Vantage alternative?
Yes, for end-of-day and intraday price data with adjusted fields and global exchanges. Alpha Vantage remains the better fit if you depend on its technical indicators, news, options, FX or crypto functions. Many teams move price calls to marketstack and keep Alpha Vantage for those.
What is the marketstack equivalent of TIME_SERIES_DAILY_ADJUSTED?
The /v2/eod endpoint. Each row includes raw OHLCV plus adj_open, adj_high, adj_low, adj_close, adj_volume, split_factor and dividend, so you don’t need a separate adjusted endpoint or a second request.
Where does the API key go in marketstack?
In the access_key query parameter, instead of Alpha Vantage’s apikey. Keep calls on your server, store the key in an environment variable or secret store, and never commit it to your repository.
How do I convert Alpha Vantage symbols like TSCO.LON?
marketstack uses the ticker plus an exchange MIC code, such as XLON, in the exchange parameter. Build a lookup table from the tickers endpoints and confirm each symbol with a test call, rather than relying on a fixed suffix rule.
Does marketstack have technical indicators like RSI or MACD?
No. Compute them locally from adj_close with pandas, or keep a separate source for indicator calls.
How many requests does a multi-symbol marketstack call use?
One per symbol: a call with five tickers uses five requests, per the marketstack product page. API errors don’t count against your monthly quota, so plan your quota on symbols × refreshes.
Marketstack
Related categories