yf-data
A simple-but-working python module that returns data from Yahoo Finance.
Features
Data include:
- OHLC values for stocks and exchange rates
- dividends
- financial data of companies (income and balance sheets).
All data are returned as Pandas Dataframe.
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"])
# Frequency for income data can be annual ("A"), quarterly ("Q") or
# trailing twelwe months ("TTM").
# Frequency for balance data 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 | 218.850006 | 219.149902 | 218.089996 | 218.740005 | 1170434.0 |
| aapl | 2024-07-26 13:31:00 | 218.389999 | 218.470001 | 218.000000 | 218.020004 | 382342.0 |
| aapl | 2024-07-26 13:32:00 | 218.054993 | 218.740005 | 218.020004 | 218.481903 | 227239.0 |
| aapl | 2024-07-26 13:33:00 | 218.479996 | 218.539993 | 217.669998 | 217.669998 | 263403.0 |
| aapl | 2024-07-26 13:34: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 income sheet 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yfdata-0.2.2.tar.gz | 51.1 kB | Without provenance | Details for yfdata-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yfdata-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for yfdata-0.2.2-py3-none-any.whl |
Total release size: 61.4 kB
Release files / yfdata-0.2.2.tar.gz
| Download URL | yfdata-0.2.2.tar.gz |
|---|---|
| Size | 51.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69d4045cb311ce3f985cefa7e72c23685b0874c8295d2d03abd73fbfe55fd4db
|
|
BLAKE2b-256 checksum How to use checksums |
0ec69a8352a217a88a8de4a67b5e928f16c82774b11356142af55b7615c03296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / yfdata-0.2.2-py3-none-any.whl
| Download URL | yfdata-0.2.2-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28089037b08b08580fbc28051d4897958c1597cea4a0fd8b19e21f25cf74ff40
|
|
BLAKE2b-256 checksum How to use checksums |
89282aebf21c7d7d849605ca7da5229d80178a8afb91c7fa92ddcf549683b046
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for yfdata 0.2.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.