Skip to main content

yf-data

application-build PyPI - Downloads

A small Python client that returns normalized Yahoo Finance data as Pandas DataFrames.

Features

Available data include:

  • OHLC values for stocks and exchange rates
  • dividends
  • company financial data from income and balance sheets

All results are returned as Pandas DataFrames.

Temporal values follow their domain semantics:

Data Temporal value Timezone rule
1-minute stock prices timezone-aware pandas.Timestamp UTC
Daily stock prices datetime.date Exchange civil date; UTC fallback
Exchange rates (1m and 1D) timezone-aware pandas.Timestamp UTC
Income and balance-sheet periods datetime.date Date reported by Yahoo
Dividends datetime.date Exchange civil date; UTC fallback

The public API does not return naive datetimes.

Usage

from yfdata import YahooProvider

yp = YahooProvider()

# Frequency for prices and exchange rates can be daily ("1D") or 1-minute ("1m").

# Get daily OHLC data.
df = yp.get_prices(["aapl"], "1D")

# Get exchange rates with frequency of 1 minute.
df = yp.get_rates("usd", "eur", freq="1m")

# Get company dividends.
df = yp.get_dividends(["aapl", "msft"])

# Income frequency can be annual ("A"), quarterly ("Q"), or
# trailing twelve months ("TTM").

# Balance-sheet frequency can be annual ("A") or quarterly ("Q").

# Get annual income data.
df = yp.get_income(["aapl", "msft"], freq="A")

# Get quarterly balance data.
df = yp.get_balance(["aapl", "msft"], freq="Q")

# Define a list of specific metrics for income data.
metrics = ["total_revenue", "ebitda"]
df = yp.get_income(["aapl", "msft"], freq="A", metrics=metrics)

Output examples

An excerpt from 1-minute OHLC price data:

ticker ts o h l c v
aapl 2024-07-26 13:30:00+00:00 218.850006 219.149902 218.089996 218.740005 1170434.0
aapl 2024-07-26 13:31:00+00:00 218.389999 218.470001 218.000000 218.020004 382342.0
aapl 2024-07-26 13:32:00+00:00 218.054993 218.740005 218.020004 218.481903 227239.0
aapl 2024-07-26 13:33:00+00:00 218.479996 218.539993 217.669998 217.669998 263403.0
aapl 2024-07-26 13:34:00+00:00 217.630005 217.630005 217.119995 217.160004 241679.0

An excerpt from annual balance data:

ticker metric freq date value
aapl total_assets A 2020-09-30 3.23888e+11
aapl total_assets A 2021-09-30 3.51002e+11
aapl total_assets A 2022-09-30 3.52755e+11
aapl total_assets A 2023-09-30 3.52583e+11
aapl ordinary_shares_number A 2020-09-30 1.69768e+10
aapl ordinary_shares_number A 2021-09-30 1.64268e+10
aapl ordinary_shares_number A 2022-09-30 1.59434e+10
aapl ordinary_shares_number A 2023-09-30 1.55501e+10

Financial metrics

Available metrics for the income statement are:

  • total_revenue
  • cost_of_revenue
  • gross_profit
  • operating_expense
  • operating_income
  • non_operating_interest_income_expense
  • other_income_expense
  • basic_eps
  • diluted_eps
  • basic_average_shares
  • total_expense
  • normalized_income
  • ebit
  • ebitda

Available metrics for balance sheet are:

  • total_assets
  • total_liabilities_net_minority_interest
  • total_equity_gross_minority_interest
  • total_capitalization
  • common_stock_equity
  • capital_lease_obligations
  • net_tangible_assets
  • working_capital
  • invested_capital
  • tangible_book_value
  • total_debt
  • net_debt
  • share_issued
  • ordinary_shares_number

Metadata

Release files for yfdata 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yfdata 0.2.4
File Size Uploaded Provenance Actions
yfdata-0.2.4.tar.gz 61.8 kB With provenance Details for yfdata-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yfdata 0.2.4
File Interpreter ABI Platform Actions
yfdata-0.2.4-py3-none-any.whl Python 3 none any Details for yfdata-0.2.4-py3-none-any.whl

Total release size: 73.7 kB

Release files / yfdata-0.2.4.tar.gz

Download URL yfdata-0.2.4.tar.gz
Size 61.8 kB
Tags Source
SHA-256 checksum
How to use checksums
77b5156d482f90839814f1b50bf5c99c828b82e1ea07647a9958f9bccfbdcc1c
BLAKE2b-256 checksum
How to use checksums
fa0d0b6d575e7a5336cb1eaa76da3f1ef64e8a9978f177f46e65c8b8e28c34d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release files / yfdata-0.2.4-py3-none-any.whl

Download URL yfdata-0.2.4-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e0b7eda6eb868e68a2b8275e6e6464b4d9e2b90e5616a8a7921b4306db1798e
BLAKE2b-256 checksum
How to use checksums
b2972363a6089df73385022f1fa6cfbeece33d200247cffe85327150e5c569a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Security for yfdata 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yfdata-0.2.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page