Python SDK for the hosted yfin Yahoo Finance API, with yfinance-compatible data access.
Project description
yfin Python SDK
yfin is a yfinance-compatible Python SDK backed by the hosted
api.yfin.dev Yahoo Finance API. The hosted API handles Yahoo Finance
contracts, crumb bootstrap, caching, request coalescing, and origin budgets.
The SDK adds pandas/yfinance-shaped access on top.
Use yfinance for a mature local-only notebook dependency. Use yfin when you want the same Python shape plus a hosted REST API, shared caching, OpenAPI, explicit rate limits, and infrastructure that absorbs Yahoo cookie/crumb/TLS and rate-limit churn.
pip install yfin
Quickstart
import yfin as yf
aapl = yf.Ticker("AAPL")
print(aapl.history(period="5d", interval="1d"))
print(aapl.fast_info)
print(aapl.info)
print(aapl.option_chain())
print(aapl.funds_data.top_holdings)
print(aapl.valuation)
print(yf.download(["AAPL", "MSFT"], period="5d"))
ws = yf.WebSocket(verbose=False)
ws.subscribe("BTC-USD")
Low-Level Hosted API Client
import yfin
client = yfin.Client(contact="you@example.com")
print(client.quote(["AAPL", "MSFT"]))
print(client.history("NVDA", range="5d", interval="1h"))
Set YFIN_BASE_URL to override the hosted API URL.
What yfin Ships
- yfinance-compatible
Ticker,Tickers,download,WebSocket, andAsyncWebSocketAPIs. - 45 CP2-confirmed Yahoo REST contracts behind
https://api.yfin.dev. - OpenAPI schema at
https://api.yfin.dev/v1/openapi.json. - Machine-readable endpoint manifest at
https://api.yfin.dev/v1/endpoints. - Cache metadata and explicit typed rate-limit errors.
Honest Performance Position
yfin is not guaranteed to beat yfinance on cold one-off notebook calls. A cold miss goes through yfin and then Yahoo. The hosted path is designed to win when requests are repeated, concurrent, cacheable, or run from services/agents that benefit from managed Yahoo access.
Recent live checks:
| Probe | Result |
|---|---|
| Anonymous forced history misses | 25/25 HTTP 200, no 429 |
| 17 forced history misses | 1.4s wall time |
| Same 17 warm hosted reads | 117ms wall time, 76ms median |
| Python SDK 17-accessor warm pass | 637ms wall time |
| Local yfinance matching 16-accessor pass | 1330ms wall time |
See the benchmark notes.
Trust And Docs
- Source
- Changelog
- yfin vs yfinance
- Compatibility matrix
- Rate limits
- Privacy policy
- LLM/crawler summary
Rate Limits
| Identity | Total requests/minute | Yahoo-origin misses/minute |
|---|---|---|
| Anonymous IP | 1200 | 120 |
X-Yfin-Contact / SDK contact= |
6000 | 600 |
| Manual API key | 30000 | 3000 |
High-volume users can email sam@yfin.dev for an API key.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yfin-0.1.5.tar.gz.
File metadata
- Download URL: yfin-0.1.5.tar.gz
- Upload date:
- Size: 39.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80af60c8df9077193dc3b060634a3e3a86419fd2887b133e675a425fa7eecea5
|
|
| MD5 |
386dfc498625c03b5bd31895e07de64d
|
|
| BLAKE2b-256 |
80f1d6ebbf546ec6c6ef21863bf9cda973e40d2125541fd8769cdda04e31e119
|
Provenance
The following attestation bundles were made for yfin-0.1.5.tar.gz:
Publisher:
publish-yfin-python.yml on bluedoor-ai/yfin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yfin-0.1.5.tar.gz -
Subject digest:
80af60c8df9077193dc3b060634a3e3a86419fd2887b133e675a425fa7eecea5 - Sigstore transparency entry: 1436663974
- Sigstore integration time:
-
Permalink:
bluedoor-ai/yfin@489667ad5c66c705013a47af2c9f0105b7052f48 -
Branch / Tag:
refs/tags/yfin-python-v0.1.5 - Owner: https://github.com/bluedoor-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-yfin-python.yml@489667ad5c66c705013a47af2c9f0105b7052f48 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yfin-0.1.5-py3-none-any.whl.
File metadata
- Download URL: yfin-0.1.5-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccacc6c82561b1b3aca943ccfee82bd4a6834baa7c00bde35df3a3780d0c36ff
|
|
| MD5 |
72f5f53eb15aeafc05b5e152e34bb277
|
|
| BLAKE2b-256 |
73a367b71602b51ad2b8395802671bc8edd36210adeb754b08835219a2ee40c0
|
Provenance
The following attestation bundles were made for yfin-0.1.5-py3-none-any.whl:
Publisher:
publish-yfin-python.yml on bluedoor-ai/yfin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yfin-0.1.5-py3-none-any.whl -
Subject digest:
ccacc6c82561b1b3aca943ccfee82bd4a6834baa7c00bde35df3a3780d0c36ff - Sigstore transparency entry: 1436663996
- Sigstore integration time:
-
Permalink:
bluedoor-ai/yfin@489667ad5c66c705013a47af2c9f0105b7052f48 -
Branch / Tag:
refs/tags/yfin-python-v0.1.5 - Owner: https://github.com/bluedoor-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-yfin-python.yml@489667ad5c66c705013a47af2c9f0105b7052f48 -
Trigger Event:
push
-
Statement type: