Guides & Comparisons · Yahoo Finance & Python
Yahoo Finance API & yfinance Alternative for Python
Yahoo shut down its official public developer API years ago. Open-source scrapers like yfinance parse undocumented web endpoints that trigger 429 Too Many Requests, rotate session crumbs without warning, and return only 4–5 periods of restated financials. QuantSet gives Python workflows a documented REST, CSV, and MCP contract with deterministic pagination and SEC XBRL provenance.
us:NVDAus:AAPLus:MSFTglobal:SHEL.Lglobal:1301.Tcrypto:BTCUSDTindex:SPX
Why yfinance breaks in backtests and cron jobs
yfinance is great for a quick notebook plot, but teams running scheduled pipelines, factor backtests, or AI agents hit the same four failure modes:
- Undocumented
429 Too Many Requests& crumb blocks: Cloud and CI runner IPs (GitHub Actions, AWS, GCP, Fly.io) regularly hit Yahoo cookie/crumb blocks or silent empty DataFrames with noRetry-Aftercontract. - Shallow, silently restated fundamentals: Scraped web tables typically expose only the last 4 annual or 4–5 quarterly statements—with no SEC accession numbers, no filing dates for point-in-time checks, and silent schema renames in
Ticker.info. - Opaque
Adj Closemath: When a reverse split or special dividend lands, scraped series frequently double-adjust or lag by days without exposing whether split and dividend factors reconciled. - Zero snapshot isolation: Paginating across hundreds of tickers while daily bars update mid-run produces inconsistent cross-sectional dates.
yfinance vs. QuantSet at a glance
| Capability | yfinance (unofficial scraper) | QuantSet API & Python SDK |
|---|---|---|
| Official contract | Scrapes internal web JSON / HTML crumbs | Versioned /api/v1 OpenAPI + deterministic JSON & CSV |
| Rate-limit transparency | Unannounced IP bans / 429 HTML challenges | Explicit X-RateLimit-Remaining & Retry-After headers |
| US equity price history | Varies by symbol; unflagged split breaks | Back to 1962 (up to 20,000 bars in one call) + cross-checked adj_close |
| Financial statements | ~4 years / 5 quarters, no filing metadata | Multi-decade SEC XBRL with available_at & accession provenance |
| Missing values | Mixed NaN, 0, or missing dict keys | Strict null when unverified—never coerced to 0 |
| AI / MCP integration | Breaks mid-prompt when rate-limited | Native hosted Streamable HTTP MCP (/mcp) + @quantset/mcp |
Side-by-side Python migration
Replace brittle yf.Ticker(...).history() and .financials calls with either pip install quantset or plain httpx / requests:
# Before: unofficial Yahoo scraper (breaks on cloud IPs & 4-year statement cap)
# import yfinance as yf
# df = yf.Ticker("NVDA").history(start="2015-01-01")
# inc = yf.Ticker("NVDA").income_stmt
# After: QuantSet Python SDK (deterministic snapshot + DataFrame conversion)
import quantset as qs
bars = qs.prices("NVDA", start="2015-01-01").to_df()
income = qs.income(["NVDA"], period="quarterly", limit_per_instrument=12).to_df()
print(bars.tail(3)[["date", "close", "adj_close", "adjustment"]])
OHLCV bars with verified adjusted close
Copy the daily bars request into your client to use the free mw_demo sandbox key. Notice how every bar explicitly reports its currency, volume unit, and split/dividend verification status—and up to 20,000 daily bars return in a single HTTP call.
curl "https://api.quantset.dev/api/v1/prices?ticker=NVDA&limit=5" -H "X-API-Key: mw_demo"
Global listings use explicit exchange suffixes under the global: namespace (for example global:SHEL.L in London, global:1301.T in Tokyo, or global:RELIANCE.NS in India) so tickers never collide across countries:
curl "https://api.quantset.dev/api/v1/prices?ticker=SHEL.L&limit=5" -H "X-API-Key: mw_demo"
SEC XBRL income statements beyond four quarters
Unlike scraped summary tables that truncate after four periods, QuantSet normalizes U.S. SEC EDGAR filings into standardized income, balance_sheet, and cash_flow rows—preserving discrete quarterly cash flows (never unlabelled 6M/9M YTD totals) alongside filing dates.
curl "https://api.quantset.dev/api/v1/financial-statements/income?tickers=us:NVDA&period=quarterly&limit_per_instrument=4" -H "X-API-Key: mw_demo"
Batch 100 tickers in 1 call (zero rate-limit anxiety)
Instead of looping yf.Ticker(sym) 100 times and triggering a 429 ban, pass up to 100 comma-separated instruments across US equities, global equities, and crypto in a single request—counted as 1 API call:
curl "https://api.quantset.dev/api/v1/quotes?tickers=us:NVDA,us:AAPL,us:MSFT,global:SHEL.L,crypto:BTCUSDT" -H "X-API-Key: mw_demo"
Common questions about Yahoo Finance API alternatives
Does Yahoo Finance still have an official free API?
No. Yahoo retired its official YQL and public finance APIs in 2017. Packages such as yfinance and yahooquery scrape undocumented frontend endpoints intended for web browsers, while third-party wrappers on API marketplaces resell those same scraped endpoints without upstream SLAs.
Can I test QuantSet in Python before buying a key?
Yes. Every endpoint above works immediately with X-API-Key: mw_demo (no signup or credit card) across nine benchmark US, global, ETF, index, and crypto instruments at 30 requests per minute. When you are ready for the full 90,000+ symbol universe, Developer plans start at $39/month (6,000 credits per month).