Skip to main content

yfin vs yfinance

yfinance is the default Python library many developers start with. yfin keeps the useful yfinance-style Python surface, then adds the pieces teams and agents usually have to build themselves: hosted HTTP endpoints, OpenAPI schemas, multi-language SDKs, explicit rate limits, and documented error responses.

Comparison

Areayfinyfinance
Public requests/minute1,200 anonymous, 6,000 with X-Yfin-Contact, 30,000 with an API keyNo managed API tier or published service quota
Public requests/second40 anonymous, 200 with X-Yfin-Contact, 2,000 with an API keyNo hosted service limit
Public REST endpoints22 named routes for quotes, history, options, fundamentals, search, screeners, market summaries, sectors, industries, and research dataNone
REST contract coverage45 shipped REST contracts behind the public APIPython calls only
OpenAPIFull API reference with schemas, examples, and error bodiesNot available
AI-native useAgents can read the docs, inspect OpenAPI, and call stable HTTP URLs from any runtimeAgents need Python execution or a custom wrapper
SDKsPython plus TypeScript/JavaScriptPython
Python migrationimport yfin as yf supports common yfinance-shaped callsAlready yfinance
Service identityOptional contact header and API keys for higher-volume appsNo service identity model
Error handlingDocumented JSON errors, Retry-After, SDK error classesLibrary/runtime exceptions vary by call path

Why It Matters

For a notebook, yfinance can be enough. For a product, backend job, hosted tool, or AI agent, yfin is the stronger shape: it gives you a real API boundary, clear request limits, schema-backed docs, and SDKs for more than one runtime.

The practical difference is that yfin can be called from Python, JavaScript, curl, serverless functions, browsers, and LLM tools using the same documented HTTP surface.

Migration Path

Most Python migrations start with the import:

- import yfinance as yf
+ import yfin as yf
import yfin as yf

ticker = yf.Ticker("AAPL", contact="you@example.com")
history = ticker.history(period="5d", interval="1d")
fast_info = ticker.fast_info

For a compatibility map of common yfinance calls, see Migrate from yfinance.

API Example

curl "https://api.yfin.dev/v1/quote?symbols=AAPL,MSFT" \
-H "X-Yfin-Contact: you@example.com"
curl "https://api.yfin.dev/v1/history?symbol=AAPL&period=5d&interval=1d"

Use the API Reference for response fields, examples, and error shapes.