Client for Yahoo Finance data
Project description
yf-data
A simple-but-working python module that returns data from Yahoo Finance.
Current Version: 0.1.7
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
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 yfdata-0.1.7.tar.gz.
File metadata
- Download URL: yfdata-0.1.7.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-1017-oracle
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4460e5f3cbf0f6898615b532972c3452e3d66c8aee0e7ed6898b7bf5c91875ad
|
|
| MD5 |
a78b2bd82b85d4c386d1c151095be677
|
|
| BLAKE2b-256 |
0bd438d85a8f0d47ba3c13cad1f318a0cd64f4c1bcd54b16b904996df3298e7f
|
File details
Details for the file yfdata-0.1.7-py3-none-any.whl.
File metadata
- Download URL: yfdata-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.14.0-1017-oracle
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbb2efa8834154ed9198e37c25bfa4a22ca18a01031ec9731cd1d5bf88fd84f0
|
|
| MD5 |
384d8d7a58f0896d73ddca2dfdf25e4b
|
|
| BLAKE2b-256 |
80ee0c7798481a632653028ca2432f27ca5ae53d1a1d42da3c06284f2b0ef8a6
|