Skip to main content

Quickstart

Install the Python package:

pip install yfin

Or install the TypeScript package:

npm install @yfin/sdk

Fetch yfinance-shaped data:

import yfin as yf

ticker = yf.Ticker("AAPL")

print(ticker.history(period="5d", interval="1d"))
print(ticker.fast_info)
print(ticker.info)
print(ticker.option_chain())

Use download() for one or more tickers:

import yfin as yf

frame = yf.download(["AAPL", "MSFT"], period="5d", interval="1d")
print(frame.tail())

Use the hosted API client when you want raw REST responses:

import yfin

client = yfin.Client(contact="[email protected]")

print(client.quote(["AAPL", "MSFT"]))
print(client.history("NVDA", range="5d", interval="1h"))

Identity

Anonymous calls work out of the box with IP-based limits. For higher public limits, declare a contact identity:

import yfin

client = yfin.Client(contact="[email protected]")

For direct REST requests, send the same identity as a header:

curl "https://api.yfin.dev/v1/quote?symbols=AAPL,MSFT" \
-H "X-Yfin-Contact: [email protected]"

High-volume users can email [email protected] for an API key.

Next Steps