Compare commits

..

50 Commits

Author SHA1 Message Date
github-actions[bot]
b656a8ab39 Update documentation 2024-11-06 09:28:16 +00:00
ValueRaider
1e15302414 Merge pull request #2115 from ericpien/docs
Adding Sphinx Documentation
2024-11-06 09:27:21 +00:00
Eric Pien
3e647a8e29 Merge branch 'docs_markdown' into docs 2024-11-05 20:02:32 -08:00
Eric Pien
d20923551d Add Sphinx Documentation
- Initial draft of Sphinx documentation using rst
    - update docstrings
    - add deploy_doc.yml for automated deployment through GitHub Actions
2024-11-05 19:56:34 -08:00
ValueRaider
664a4b4b59 Manually restore docs/ & mkdocs.yml changes lost during rebase 2024-11-03 11:34:47 +00:00
Ran Aroussi
43f311d695 Delete CNAME 2024-11-03 11:29:14 +00:00
Ran Aroussi
2c43de5f92 Create CNAME 2024-11-03 11:29:14 +00:00
silvavn
d324fde012 Documented util.py 2024-11-03 11:29:13 +00:00
silvavn
ad2f17fffa added advanced usage 2024-11-03 11:22:16 +00:00
silvavn
977d3144c5 fixing documentation 2024-11-03 11:21:54 +00:00
ValueRaider
0bc22f82bb Merge pull request #2108 from ranaroussi/main
sync main -> dev
2024-11-02 12:38:00 +00:00
Ran Aroussi
5e942fdec4 Refactor multi.py to handle single tickers and rename columns 2024-10-25 19:02:07 +01:00
Ran Aroussi
16072e87df Bump version to 0.2.48 2024-10-25 18:59:19 +01:00
Ran Aroussi
6946f99e30 Refactor multi.py to handle single tickers and rename columns 2024-10-25 18:59:03 +01:00
Ran Aroussi
1397dcc4bc Update version.py 2024-10-25 11:34:13 +01:00
Ran Aroussi
7fee3039f4 Delete .DS_Store 2024-10-25 11:33:08 +01:00
Ran Aroussi
4beb489f82 Refactor multi.py to handle single tickers and rename columns 2024-10-25 11:31:20 +01:00
ValueRaider
0f570c4684 Merge pull request #2097 from eltociear/patch-1
docs: update README.md
2024-10-22 18:55:03 +01:00
Ikko Eltociear Ashimine
b32e57fcfe docs: update README.md
minor fix
2024-10-22 17:19:56 +09:00
ValueRaider
0ec5151ff3 Version 0.2.46 2024-10-21 18:37:53 +01:00
ValueRaider
b88a0a6bf5 Merge pull request #2094 from FX196/patch-1
Fix malformed f-string in release `0.2.45`
2024-10-21 18:36:49 +01:00
Yuhong Chen
c218848a69 Fix malformed f-string 2024-10-20 17:36:22 -07:00
ValueRaider
f19dff247e Version 0.2.45 2024-10-20 22:59:16 +01:00
ValueRaider
1de113eccd Merge pull request #2091 from ranaroussi/dev
sync dev -> main
2024-10-20 22:56:26 +01:00
ValueRaider
8daa477167 Merge pull request #2090 from ranaroussi/feature/divident-repair-improve
Feature/dividend repair improve
2024-10-20 22:55:52 +01:00
ValueRaider
3152715d45 Improve divident repair
Dividend repair tweaks:
- handle coincident split missing from dividend
- avoid 100x price changes confusing detection of div too-big/small
- improve detecting div-date-wrong
2024-10-20 21:50:08 +01:00
ValueRaider
ee657b24d5 Merge pull request #2087 from ranaroussi/fix/debug-msg
Fix IndexError in some history() debug messages
2024-10-20 16:31:33 +01:00
ValueRaider
4672715a86 Merge pull request #2066 from ericpien/screener
Implement Screener Feature
2024-10-19 22:13:46 +01:00
Eric Pien
4a70b59db9 Simplify README for Screener
- Reduce the information provided in README with the expectation of migrating to separate documentation.
2024-10-19 09:27:32 -07:00
Ran Aroussi
12e815d977 Update README.md 2024-10-17 21:51:59 +01:00
ValueRaider
e282d1b59c Fix IndexError in some history() debug messages 2024-10-12 11:48:11 +01:00
ValueRaider
7e0946ed37 Merge pull request #2080 from ranaroussi/main
sync main -> dev
2024-10-07 21:30:03 +01:00
ValueRaider
a21fc073b8 Merge pull request #2059 from marco-carvalho/patch-1
Add Pyright type checking
2024-10-07 19:50:24 +01:00
ValueRaider
a9e3cf0780 Merge pull request #2072 from algonell/main
Fix typos
2024-10-05 20:08:10 +01:00
ValueRaider
0f63ecc2bd Merge pull request #2068 from antoniouaa/fix_tickers_single
fix keyerror with single element list passed to Tickers
2024-10-03 20:09:52 +01:00
Andrew Kreimer
10800a1070 Fix typos 2024-10-03 22:01:53 +03:00
Andrew Kreimer
db39b3fca4 Fix a typo 2024-10-03 22:00:57 +03:00
Andrew Kreimer
10d6221718 Fix typos 2024-10-03 22:00:29 +03:00
ValueRaider
17f07e08ef Merge pull request #2069 from ranaroussi/main
sync main -> dev
2024-10-02 20:12:48 +01:00
ValueRaider
f82823c624 Merge pull request #2067 from ranaroussi/fix/tests-context
Fix unit tests contextual imports
2024-10-02 20:11:30 +01:00
antoniouaa
ebc4e200c1 fix keyerror with single element list passed to Tickers 2024-10-01 23:15:54 +01:00
ValueRaider
a8df88b2d2 Fix unit tests contextual imports 2024-10-01 21:24:51 +01:00
Eric Pien
048378ea20 Implement Screener
- Add a new class Screener, Query, and EquityQuery
- Refactor YfData.get() to enable YfData.post() to all of get's implementations
- Add test for the Screener
- Add new set and map to const

Screener can be used to filter yahoo finance. This can be used to get the top gainers of the day, and more customized queries that a user may want to automate.
2024-09-30 18:01:11 -07:00
Marco Carvalho
f1d5c1d06f Update pyright.yml 2024-09-19 16:08:40 -03:00
Marco Carvalho
d65bf2d761 Update requirements.txt 2024-09-19 15:57:55 -03:00
Marco Carvalho
81deec0d6c Update pyrightconfig.json 2024-09-19 11:32:57 -03:00
Marco Carvalho
74f44a4e1e Update pyright.yml 2024-09-19 11:14:09 -03:00
Marco Carvalho
691904202b Create pyright.yml 2024-09-19 11:09:13 -03:00
Marco Carvalho
3fc54ab249 Create pyrightconfig.json 2024-09-19 11:08:56 -03:00
Marco Carvalho
d7c6f5f320 Update requirements.txt 2024-09-19 11:08:08 -03:00
426 changed files with 117463 additions and 428 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

53
.github/workflows/deploy_doc.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Build and Deploy Sphinx Docs
on:
push:
branches:
- docs_markdown
jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_DIR: "doc/_build/html"
DEPLOY_BRANCH: "docs_markdown"
DEPLOY_DIR: "docs"
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install Sphinx==8.0.2 pydata-sphinx-theme==0.15.4 Jinja2==3.1.4 sphinx-copybutton==0.5.2
- name: Build Sphinx documentation
run: |
sphinx-build -b html doc/source ${{ env.BUILD_DIR }} -v
- name: List generated HTML files
run: |
ls -l -R ${{ env.BUILD_DIR }}
- name: Publish to the Deploy Branch
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout ${{ env.DEPLOY_BRANCH }}
mkdir -p ${{ env.DEPLOY_DIR }}
rm -rf ${{ env.DEPLOY_DIR }}/*
cp -r ${{ env.BUILD_DIR }}/* ${{ env.DEPLOY_DIR }}/
touch ${{ env.DEPLOY_DIR }}/.nojekyll
git add -f ${{ env.DEPLOY_DIR }}
git commit -m "Update documentation"
git push origin ${{ env.DEPLOY_BRANCH }}

27
.github/workflows/pyright.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Pyright
on:
pull_request:
branches:
- master
- main
- dev
jobs:
pyright:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyright
- name: Run Pyright
run: pyright . --level error

7
.gitignore vendored
View File

@@ -18,3 +18,10 @@ test.ipynb
env/
venv/
ENV/
# Documentation
/doc/build/
/doc/_build/
/doc/source/reference/api
!yfinance.css
!/doc/source/development/assets/branches.png

View File

@@ -1,6 +1,23 @@
Change Log
===========
0.2.46
------
Fix regression in 0.2.45 #2094
0.2.45
------
Features:
- Screener #2066 @ericpien
Fixes
- Tickers keyerror #2068 @antoniouaa
- IndexError in some history() debug messages #2087
- improve dividend repair #2090
Maintenance
- fix unit tests contextual imports #2067
- fix typos #2072 @algonell
- add Pyright type checking #2059 @marco-carvalho
0.2.44
------
Features:
@@ -359,7 +376,7 @@ Jumping to 0.2 for this big update. 0.1.* will continue to receive bug-fixes
- Fix timezone handling
- Fix handling of missing data
- Clean&format earnings_dates table
- Add ``.get_earnings_dates()`` to retreive earnings calendar
- Add ``.get_earnings_dates()`` to retrieve earnings calendar
- Added ``.get_earnings_history()`` to fetch earnings data
0.1.70
@@ -671,7 +688,7 @@ Jumping to 0.2 for this big update. 0.1.* will continue to receive bug-fixes
- Removed 5 second wait for every failed fetch
- Reduced TTL for Yahoo!'s cookie
- Keeps track of failed downloads and tries to re-download all failed downloads one more time before giving up
- Added progress bar (can be turned off useing ``progress=False``)
- Added progress bar (can be turned off using ``progress=False``)
0.0.7
-------

297
README.md
View File

@@ -28,7 +28,6 @@ Yahoo! finance API is intended for personal use only.**
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/v/yfinance.svg?maxAge=60%" alt="PyPi version"></a>
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/status/yfinance.svg?maxAge=60" alt="PyPi status"></a>
<a target="new" href="https://pypi.python.org/pypi/yfinance"><img border=0 src="https://img.shields.io/pypi/dm/yfinance.svg?maxAge=2592000&label=installs&color=%2327B1FF" alt="PyPi downloads"></a>
<a target="new" href="https://travis-ci.com/github/ranaroussi/yfinance"><img border=0 src="https://img.shields.io/travis/ranaroussi/yfinance/main.svg?maxAge=1" alt="Travis-CI build status"></a>
<a target="new" href="https://www.codefactor.io/repository/github/ranaroussi/yfinance"><img border=0 src="https://www.codefactor.io/repository/github/ranaroussi/yfinance/badge" alt="CodeFactor"></a>
<a target="new" href="https://github.com/ranaroussi/yfinance"><img border=0 src="https://img.shields.io/github/stars/ranaroussi/yfinance.svg?style=social&label=Star&maxAge=60" alt="Star this repo"></a>
<a target="new" href="https://twitter.com/aroussi"><img border=0 src="https://img.shields.io/twitter/follow/aroussi.svg?style=social&label=Follow&maxAge=60" alt="Follow me on twitter"></a>
@@ -36,19 +35,16 @@ Yahoo! finance API is intended for personal use only.**
**yfinance** offers a threaded and Pythonic way to download market data from [Yahoo!Ⓡ finance](https://finance.yahoo.com).
→ Check out this [Blog post](https://aroussi.com/#post/python-yahoo-finance) for a detailed tutorial with code examples.
## Main Features
- `Ticker` module: Class for accessing single ticker data.
- `Tickers` module: Class for handling multiple tickers.
- `download` Efficiently download market data for multiple tickers.
- `Sector` and `Industry` modules : Classes for accessing sector and industry information.
- Market Screening: `EquityQuery` and `Screener` to build query and screen the market.
- Caching and Smart Scraping
[Changelog »](https://github.com/ranaroussi/yfinance/blob/main/CHANGELOG.rst)
---
- [Installation](#installation)
- [Quick start](#quick-start)
- [Advanced](#logging)
- [Wiki](https://github.com/ranaroussi/yfinance/wiki)
- [Contribute](#developers-want-to-contribute)
---
## Documentation
The official documentation is available on [ranaroussi.github.io/yfinance](https://ranaroussi.github.io/yfinance/index.html)
## Installation
@@ -68,281 +64,10 @@ $ pip install "yfinance[optional]"
[Required dependencies](./requirements.txt) , [all dependencies](./setup.py#L62).
---
The list of changes can be found in the [changelog](https://github.com/ranaroussi/yfinance/blob/main/CHANGELOG.rst)
## Quick Start
### The Ticker module
The `Ticker` module, which allows you to access ticker data in a more Pythonic way:
```python
import yfinance as yf
msft = yf.Ticker("MSFT")
# get all stock info
msft.info
# get historical market data
hist = msft.history(period="1mo")
# show meta information about the history (requires history() to be called first)
msft.history_metadata
# show actions (dividends, splits, capital gains)
msft.actions
msft.dividends
msft.splits
msft.capital_gains # only for mutual funds & etfs
# show share count
msft.get_shares_full(start="2022-01-01", end=None)
# show financials:
msft.calendar
msft.sec_filings
# - income statement
msft.income_stmt
msft.quarterly_income_stmt
# - balance sheet
msft.balance_sheet
msft.quarterly_balance_sheet
# - cash flow statement
msft.cashflow
msft.quarterly_cashflow
# see `Ticker.get_income_stmt()` for more options
# show holders
msft.major_holders
msft.institutional_holders
msft.mutualfund_holders
msft.insider_transactions
msft.insider_purchases
msft.insider_roster_holders
msft.sustainability
# show recommendations
msft.recommendations
msft.recommendations_summary
msft.upgrades_downgrades
# show analysts data
msft.analyst_price_targets
msft.earnings_estimate
msft.revenue_estimate
msft.earnings_history
msft.eps_trend
msft.eps_revisions
msft.growth_estimates
# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
msft.earnings_dates
# show ISIN code - *experimental*
# ISIN = International Securities Identification Number
msft.isin
# show options expirations
msft.options
# show news
msft.news
# get option chain for specific expiration
opt = msft.option_chain('YYYY-MM-DD')
# data available via: opt.calls, opt.puts
```
For tickers that are ETFs/Mutual Funds, `Ticker.funds_data` provides access to fund related data.
Funds' Top Holdings and other data with category average is returned as `pd.DataFrame`.
```python
import yfinance as yf
spy = yf.Ticker('SPY')
data = spy.funds_data
# show fund description
data.description
# show operational information
data.fund_overview
data.fund_operations
# show holdings related information
data.asset_classes
data.top_holdings
data.equity_holdings
data.bond_holdings
data.bond_ratings
data.sector_weightings
```
If you want to use a proxy server for downloading data, use:
```python
import yfinance as yf
msft = yf.Ticker("MSFT")
msft.history(..., proxy="PROXY_SERVER")
msft.get_actions(proxy="PROXY_SERVER")
msft.get_dividends(proxy="PROXY_SERVER")
msft.get_splits(proxy="PROXY_SERVER")
msft.get_capital_gains(proxy="PROXY_SERVER")
msft.get_balance_sheet(proxy="PROXY_SERVER")
msft.get_cashflow(proxy="PROXY_SERVER")
msft.option_chain(..., proxy="PROXY_SERVER")
...
```
### Multiple tickers
To initialize multiple `Ticker` objects, use
```python
import yfinance as yf
tickers = yf.Tickers('msft aapl goog')
# access each ticker using (example)
tickers.tickers['MSFT'].info
tickers.tickers['AAPL'].history(period="1mo")
tickers.tickers['GOOG'].actions
```
To download price history into one table:
```python
import yfinance as yf
data = yf.download("SPY AAPL", period="1mo")
```
#### `yf.download()` and `Ticker.history()` have many options for configuring fetching and processing. [Review the Wiki](https://github.com/ranaroussi/yfinance/wiki) for more options and detail.
### Sector and Industry
The `Sector` and `Industry` modules allow you to access the US market information.
To initialize, use the relevant sector or industry key as below. (Complete mapping of the keys is available in `const.py`.)
```python
import yfinance as yf
tech = yf.Sector('technology')
software = yf.Industry('software-infrastructure')
# Common information
tech.key
tech.name
tech.symbol
tech.ticker
tech.overview
tech.top_companies
tech.research_reports
# Sector information
tech.top_etfs
tech.top_mutual_funds
tech.industries
# Industry information
software.sector_key
software.sector_name
software.top_performing_companies
software.top_growth_companies
```
The modules can be chained with Ticker as below.
```python
import yfinance as yf
# Ticker to Sector and Industry
msft = yf.Ticker('MSFT')
tech = yf.Sector(msft.info.get('sectorKey'))
software = yf.Industry(msft.info.get('industryKey'))
# Sector and Industry to Ticker
tech_ticker = tech.ticker
tech_ticker.info
software_ticker = software.ticker
software_ticker.history()
```
### Logging
`yfinance` now uses the `logging` module to handle messages, default behaviour is only print errors. If debugging, use `yf.enable_debug_mode()` to switch logging to debug with custom formatting.
### Smarter scraping
Install the `nospam` packages for smarter scraping using `pip` (see [Installation](#installation)). These packages help cache calls such that Yahoo is not spammed with requests.
To use a custom `requests` session, pass a `session=` argument to
the Ticker constructor. This allows for caching calls to the API as well as a custom way to modify requests via the `User-agent` header.
```python
import requests_cache
session = requests_cache.CachedSession('yfinance.cache')
session.headers['User-agent'] = 'my-program/1.0'
ticker = yf.Ticker('msft', session=session)
# The scraped response will be stored in the cache
ticker.actions
```
Combine `requests_cache` with rate-limiting to avoid triggering Yahoo's rate-limiter/blocker that can corrupt data.
```python
from requests import Session
from requests_cache import CacheMixin, SQLiteCache
from requests_ratelimiter import LimiterMixin, MemoryQueueBucket
from pyrate_limiter import Duration, RequestRate, Limiter
class CachedLimiterSession(CacheMixin, LimiterMixin, Session):
pass
session = CachedLimiterSession(
limiter=Limiter(RequestRate(2, Duration.SECOND*5)), # max 2 requests per 5 seconds
bucket_class=MemoryQueueBucket,
backend=SQLiteCache("yfinance.cache"),
)
```
### Managing Multi-Level Columns
The following answer on Stack Overflow is for [How to deal with
multi-level column names downloaded with
yfinance?](https://stackoverflow.com/questions/63107801)
- `yfinance` returns a `pandas.DataFrame` with multi-level column
names, with a level for the ticker and a level for the stock price
data
- The answer discusses:
- How to correctly read the the multi-level columns after
saving the dataframe to a csv with `pandas.DataFrame.to_csv`
- How to download single or multiple tickers into a single
dataframe with single level column names and a ticker column
### Persistent cache store
To reduce Yahoo, yfinance store some data locally: timezones to localize dates, and cookie. Cache location is:
- Windows = C:/Users/\<USER\>/AppData/Local/py-yfinance
- Linux = /home/\<USER\>/.cache/py-yfinance
- MacOS = /Users/\<USER\>/Library/Caches/py-yfinance
You can direct cache to use a different location with `set_tz_cache_location()`:
```python
import yfinance as yf
yf.set_tz_cache_location("custom/cache/location")
...
```
---
## Developers: want to contribute?
`yfinance` relies on community to investigate bugs and contribute code. Developer guide: https://github.com/ranaroussi/yfinance/discussions/1084
---
@@ -365,6 +90,6 @@ details on your rights to use the actual data downloaded.
### P.S.
Please drop me an note with any feedback you have.
Please drop me a note with any feedback you have.
**Ran Aroussi**

20
doc/Makefile Normal file
View File

@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

35
doc/make.bat Normal file
View File

@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

View File

@@ -0,0 +1,4 @@
/* Hide the "Section Navigation" title */
p.bd-links__title {
display: none;
}

View File

@@ -0,0 +1,30 @@
{{ fullname | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block attributes %}
{% if attributes %}
.. rubric:: Attributes
.. autosummary::
:toctree: attributes
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block methods %}
{% if methods %}
.. rubric:: Methods
.. autosummary::
:toctree: methods
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

45
doc/source/conf.py Normal file
View File

@@ -0,0 +1,45 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'yfinance - market data downloader'
copyright = '2017-2019 Ran Aroussi'
author = 'Ran Aroussi'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.napoleon',
"sphinx.ext.githubpages",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx_copybutton"]
templates_path = ['_templates']
exclude_patterns = []
autoclass_content = 'both'
autosummary_generate = True
autodoc_default_options = {
'exclude-members': '__init__'
}
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_title = 'yfinance'
html_theme = 'pydata_sphinx_theme'
html_theme_options = {
"github_url": "https://github.com/ranaroussi/yfinance",
"navbar_align": "left"
}
html_static_path = ['_static']
html_css_files = ['yfinance.css']

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,109 @@
********************************
Contributiong to yfinance
********************************
`yfinance` relies on the community to investigate bugs and contribute code. Heres how you can help:
Contributing
------------
1. Fork the repository on GitHub.
2. Clone your forked repository:
.. code-block:: bash
git clone https://github.com/your-username/yfinance.git
3. Create a new branch for your feature or bug fix:
.. code-block:: bash
git checkout -b feature-branch-name
4. Make your changes, commit them, and push your branch to GitHub. To keep the commit history and `network graph <https://github.com/ranaroussi/yfinance/network>`_ compact:
Use short summaries for commits
.. code-block:: shell
git commit -m "short summary" -m "full commit message"
**Squash** tiny or negligible commits with meaningful ones.
.. code-block:: shell
git rebase -i HEAD~2
git push --force-with-lease origin <branch-name>
5. Open a pull request on the `yfinance` GitHub page.
For more information, see the `Developer Guide <https://github.com/ranaroussi/yfinance/discussions/1084>`_.
Branches
---------
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
.. image:: assets/branches.png
:alt: Branching Model
`Inspiration <https://miro.medium.com/max/700/1*2YagIpX6LuauC3ASpwHekg.png>`_
- **dev**: New features and some bug fixes are merged here. This branch allows collective testing, conflict resolution, and further stabilization before merging into the stable branch.
- **main**: Stable branch where PIP releases are created.
By default, branches target **main**, but most contributions should target **dev**.
**Exceptions**:
Direct merges to **main** are allowed if:
- `yfinance` is massively broken
- Part of `yfinance` is broken, and the fix is simple and isolated
Unit Tests
----------
Tests are written using Pythons `unittest` module. Here are some ways to run tests:
- **Run all price tests**:
.. code-block:: shell
python -m unittest tests.test_prices
- **Run a subset of price tests**:
.. code-block:: shell
python -m unittest tests.test_prices.TestPriceRepair
- **Run a specific test**:
.. code-block:: shell
python -m unittest tests.test_prices.TestPriceRepair.test_ticker_missing
- **Run all tests**:
.. code-block:: shell
python -m unittest discover -s tests
Rebasing
--------------
If asked to move your branch from **main** to **dev**:
1. Ensure all relevant branches are pulled.
2. Run:
.. code-block:: shell
git checkout <your-branch>
git rebase --onto dev main <branch-name>
git push --force-with-lease origin <branch-name>
Running the GitHub Version of yfinance
--------------------------------------
To download and run a GitHub version of `yfinance`, refer to `GitHub discussion <https://github.com/ranaroussi/yfinance/discussions/1080>`_

View File

@@ -0,0 +1,46 @@
*************************************
Contribution to the documentation
*************************************
.. contents:: Documentation:
:local:
About documentation
------------------------
* yfinance documentation is written in reStructuredText (rst) and built using Sphinx.
* The documentation file is in `doc/source/..`.
* Most of the notes under API References read from class and methods docstrings. These documentations, found in `doc/source/reference/api` is autogenerated by Sphinx and not included in git.
Building documentation locally
-------------------------------
To build the documentation locally, follow these steps:
1. **Install Required Dependencies**:
* Make sure `Sphinx` and any other dependencies are installed. If a `requirements.txt` file is available, you can install dependencies by running:
.. code-block:: console
pip install -r requirements.txt
2. **Build with Sphinx**:
* After dependencies are installed, use the sphinx-build command to generate HTML documentation.
* Go to `doc/` directory Run:
.. code-block:: console
make clean && make html
3. **View Documentation Locally**:
* Open `doc/build/html/index.html` in the browser to view the generated documentation.
Building documentation on main
-------------------------------
The documentation updates are built on merge to `main` branch. This is done via GitHub Actions workflow based on `/yfinance/.github/workflows/deploy_doc.yml`.
1. Reivew the changes locally and push to `dev`.
2. When `dev` gets merged to `main`, GitHub Actions workflow is automated to build documentation.

View File

@@ -0,0 +1,9 @@
Development
===============================
.. toctree::
:maxdepth: 1
contributing
documentation
reporting_bug

View File

@@ -0,0 +1,5 @@
********************************
Reporting a Bug
********************************
Open a new issue on our `GitHub <https://github.com/ranaroussi/yfinance/issues>`_.

View File

@@ -0,0 +1,9 @@
Getting Started
===============
.. toctree::
:maxdepth: 1
installation
quick_start
legal

View File

@@ -0,0 +1,17 @@
********************
Installation Guide
********************
Install `yfinance` using `pip`:
.. code-block:: bash
$ pip install yfinance --upgrade --no-cache-dir
To install with optional dependencies, replace `optional` with: `nospam` for `caching-requests <https://github.com/ranaroussi/yfinance?tab=readme-ov-file#smarter-scraping>`_, `repair` for `price repair <https://github.com/ranaroussi/yfinance/wiki/Price-repair>`_, or `nospam`, `repair` for both:
.. code-block:: bash
$ pip install "yfinance[optional]"
For required dependencies, check out the `requirements file <./requirements.txt>`_, and for all dependencies, see the `setup.py file <./setup.py#L62>`_.

View File

@@ -0,0 +1,12 @@
********************
Legal Information
********************
yfinance is distributed under the Apache Software License. See the `LICENSE.txt <../../../../LICENSE.txt>`_ file for details.
Again, yfinance is **not** affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes.
Refer to Yahoo!'s terms of use:
- `API Terms <https://policies.yahoo.com/us/en/yahoo/terms/product-atos/apiforydn/index.htm>`_
- `Yahoo Terms <https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html>`_

View File

@@ -0,0 +1,30 @@
********************
Quick Start
********************
The Ticker module allows you to access ticker data in a more Pythonic way:
.. code-block:: python
import yfinance as yf
msft = yf.Ticker("MSFT")
# get all stock info
msft.info
# get historical market data
hist = msft.history(period="1mo")
# show actions (dividends, splits, capital gains)
msft.actions
msft.dividends
msft.splits
To work with multiple tickers, use:
.. code-block:: python
tickers = yf.Tickers('msft aapl goog')
tickers.tickers['MSFT'].info
tickers.tickers['AAPL'].history(period="1mo")

30
doc/source/index.rst Normal file
View File

@@ -0,0 +1,30 @@
yfinance documentation
==============================================
Download Market Data from Yahoo! Finance's API
------------------------------------------------
.. admonition:: IMPORTANT LEGAL DISCLAIMER
**Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.**
yfinance is **not** affiliated, endorsed, or vetted by Yahoo, Inc. It's
an open-source tool that uses Yahoo's publicly available APIs, and is
intended for research and educational purposes.
**You should refer to Yahoo!'s terms of use**
(`here <https://policies.yahoo.com/us/en/yahoo/terms/product-atos/apiforydn/index.htm>`__),
(`here <https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html>`__),
and (`here <https://policies.yahoo.com/us/en/yahoo/terms/index.htm>`__)
for details on your rights to use the actual data downloaded.
Remember - the Yahoo! finance API is intended for personal use only.
.. toctree::
:maxdepth: 3
:hidden:
:titlesonly:
getting_started/index
user_guide/index
reference/index
development/index

View File

@@ -0,0 +1,2 @@
import yfinance as yf
data = yf.download("SPY AAPL", period="1mo")

View File

@@ -0,0 +1,18 @@
import yfinance as yf
spy = yf.Ticker('SPY')
data = spy.funds_data
# show fund description
data.description
# show operational information
data.fund_overview
data.fund_operations
# show holdings related information
data.asset_classes
data.top_holdings
data.equity_holdings
data.bond_holdings
data.bond_ratings
data.sector_weightings

View File

@@ -0,0 +1,13 @@
import yfinance as yf
msft = yf.Ticker("MSFT")
msft.history(..., proxy="PROXY_SERVER")
msft.get_actions(proxy="PROXY_SERVER")
msft.get_dividends(proxy="PROXY_SERVER")
msft.get_splits(proxy="PROXY_SERVER")
msft.get_capital_gains(proxy="PROXY_SERVER")
msft.get_balance_sheet(proxy="PROXY_SERVER")
msft.get_cashflow(proxy="PROXY_SERVER")
msft.option_chain(..., proxy="PROXY_SERVER")
...

View File

@@ -0,0 +1,25 @@
import yfinance as yf
tech = yf.Sector('technology')
software = yf.Industry('software-infrastructure')
# Common information
tech.key
tech.name
tech.symbol
tech.ticker
tech.overview
tech.top_companies
tech.research_reports
# Sector information
tech.top_etfs
tech.top_mutual_funds
tech.industries
# Industry information
software.sector_key
software.sector_name
software.top_performing_companies
software.top_growth_companies

View File

@@ -0,0 +1,11 @@
import yfinance as yf
# Ticker to Sector and Industry
msft = yf.Ticker('MSFT')
tech = yf.Sector(msft.info.get('sectorKey'))
software = yf.Industry(msft.info.get('industryKey'))
# Sector and Industry to Ticker
tech_ticker = tech.ticker
tech_ticker.info
software_ticker = software.ticker
software_ticker.history()

View File

@@ -0,0 +1,77 @@
import yfinance as yf
msft = yf.Ticker("MSFT")
# get all stock info
msft.info
# get historical market data
hist = msft.history(period="1mo")
# show meta information about the history (requires history() to be called first)
msft.history_metadata
# show actions (dividends, splits, capital gains)
msft.actions
msft.dividends
msft.splits
msft.capital_gains # only for mutual funds & etfs
# show share count
msft.get_shares_full(start="2022-01-01", end=None)
# show financials:
msft.calendar
msft.sec_filings
# - income statement
msft.income_stmt
msft.quarterly_income_stmt
# - balance sheet
msft.balance_sheet
msft.quarterly_balance_sheet
# - cash flow statement
msft.cashflow
msft.quarterly_cashflow
# see `Ticker.get_income_stmt()` for more options
# show holders
msft.major_holders
msft.institutional_holders
msft.mutualfund_holders
msft.insider_transactions
msft.insider_purchases
msft.insider_roster_holders
msft.sustainability
# show recommendations
msft.recommendations
msft.recommendations_summary
msft.upgrades_downgrades
# show analysts data
msft.analyst_price_targets
msft.earnings_estimate
msft.revenue_estimate
msft.earnings_history
msft.eps_trend
msft.eps_revisions
msft.growth_estimates
# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
msft.earnings_dates
# show ISIN code - *experimental*
# ISIN = International Securities Identification Number
msft.isin
# show options expirations
msft.options
# show news
msft.news
# get option chain for specific expiration
opt = msft.option_chain('YYYY-MM-DD')
# data available via: opt.calls, opt.puts

View File

@@ -0,0 +1,8 @@
import yfinance as yf
tickers = yf.Tickers('msft aapl goog')
# access each ticker using (example)
tickers.tickers['MSFT'].info
tickers.tickers['AAPL'].history(period="1mo")
tickers.tickers['GOOG'].actions

View File

@@ -0,0 +1,33 @@
=======================
API Reference
=======================
Overview
--------
The `yfinance` package provides easy access to Yahoo! Finance's API to retrieve market data. It includes classes and functions for downloading historical market data, accessing ticker information, managing cache, and more.
Public API
==========
The following are the publicly available classes, and functions exposed by the `yfinance` package:
- :attr:`Ticker <yfinance.Ticker>`: Class for accessing single ticker data.
- :attr:`Tickers <yfinance.Tickers>`: Class for handling multiple tickers.
- :attr:`Sector <yfinance.Sector>`: Domain class for accessing sector information.
- :attr:`Industry <yfinance.Industry>`: Domain class for accessing industry information.
- :attr:`download <yfinance.download>`: Function to download market data for multiple tickers.
- :attr:`EquityQuery <yfinance.EquityQuery>`: Class to build equity market query.
- :attr:`Screener <yfinance.Screener>`: Class to screen the market using defined query.
- :attr:`enable_debug_mode <yfinance.enable_debug_mode>`: Function to enable debug mode for logging.
- :attr:`set_tz_cache_location <yfinance.set_tz_cache_location>`: Function to set the timezone cache location.
.. toctree::
:maxdepth: 1
:hidden:
yfinance.ticker_tickers
yfinance.sector_industry
yfinance.functions

View File

@@ -0,0 +1,51 @@
=========================
Functions and Utilities
=========================
.. currentmodule:: yfinance
Download Market Data
~~~~~~~~~~~~~~~~~~~~~
The `download` function allows you to retrieve market data for multiple tickers at once.
.. autosummary::
:toctree: api/
download
Query Market Data
~~~~~~~~~~~~~~~~~~~~~
The `Sector` and `Industry` modules allow you to access the sector and industry information.
.. autosummary::
:toctree: api/
EquityQuery
Screener
.. seealso::
:attr:`EquityQuery.valid_operand_fields <yfinance.EquityQuery.valid_operand_fields>`
supported operand values for query
:attr:`EquityQuery.valid_eq_operand_map <yfinance.EquityQuery.valid_eq_operand_map>`
supported `EQ query operand parameters`
:attr:`Screener.predefined_bodies <yfinance.Screener.predefined_bodies>`
supported predefined screens
Enable Debug Mode
~~~~~~~~~~~~~~~~~
Enables logging of debug information for the `yfinance` package.
.. autosummary::
:toctree: api/
enable_debug_mode
Set Timezone Cache Location
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the cache location for timezone data.
.. autosummary::
:toctree: api/
set_tz_cache_location

View File

@@ -0,0 +1,32 @@
=======================
Sector and Industry
=======================
.. currentmodule:: yfinance
Class
------------
The `Sector` and `Industry` modules provide access to the Sector and Industry information.
.. autosummary::
:toctree: api/
:recursive:
Sector
Industry
.. seealso::
:attr:`Sector.industries <yfinance.Sector.industries>`
Map of sector and industry
Sample Code
------------
To initialize, use the relevant sector or industry key as below.
.. literalinclude:: examples/sector_industry.py
:language: python
The modules can be chained with Ticker as below.
.. literalinclude:: examples/sector_industry_ticker.py
:language: python

View File

@@ -0,0 +1,46 @@
=====================
Ticker and Tickers
=====================
.. currentmodule:: yfinance
Class
------------
The `Ticker` module, allows you to access ticker data in a Pythonic way.
.. autosummary::
:toctree: api/
Ticker
Tickers
Sample Code
------------
The `Ticker` module, allows you to access ticker data in a Pythonic way.
.. literalinclude:: examples/ticker.py
:language: python
To initialize multiple `Ticker` objects, use
.. literalinclude:: examples/tickers.py
:language: python
For tickers that are ETFs/Mutual Funds, `Ticker.funds_data` provides access to fund related data.
Funds' Top Holdings and other data with category average is returned as `pd.DataFrame`.
.. literalinclude:: examples/funds_data.py
:language: python
If you want to use a proxy server for downloading data, use:
.. literalinclude:: examples/proxy.py
:language: python
To initialize multiple `Ticker` objects, use `Tickers` module
.. literalinclude:: examples/tickers.py
:language: python

View File

@@ -0,0 +1,11 @@
User Guide
==========
.. toctree::
:maxdepth: 1
logging
proxy
smart_scraping
persistent_cache
multi_level_columns

View File

@@ -0,0 +1,11 @@
Logging in yfinance
===================
`yfinance` uses the `logging` module to handle messages. By default, only errors are logged.
If debugging, you can switch to debug mode with custom formatting using:
.. code-block:: python
import yfinance as yf
yf.enable_debug_mode()

View File

@@ -0,0 +1,13 @@
******************************
Managing Multi-Level Columns
******************************
The following answer on Stack Overflow is for `How to deal with
multi-level column names downloaded with yfinance? <https://stackoverflow.com/questions/63107801>`_
- `yfinance` returns a `pandas.DataFrame` with multi-level column names, with a level for the ticker and a level for the stock price data
The answer discusses:
- How to correctly read the the multi-level columns after saving the dataframe to a csv with `pandas.DataFrame.to_csv`
- How to download single or multiple tickers into a singledataframe with single level column names and a ticker column

View File

@@ -0,0 +1,16 @@
******************************
Persistent Cache Store
******************************
To reduce Yahoo, yfinance store some data locally: timezones to localize dates, and cookie. Cache location is:
- Windows = C:/Users/\<USER\>/AppData/Local/py-yfinance
- Linux = /home/\<USER\>/.cache/py-yfinance
- MacOS = /Users/\<USER\>/Library/Caches/py-yfinance
You can direct cache to use a different location with `set_tz_cache_location()`:
.. code-block:: python
import yfinance as yf
yf.set_tz_cache_location("custom/cache/location")

View File

@@ -0,0 +1,11 @@
*********************
Using a Proxy Server
*********************
You can download data via a proxy:
.. code-block:: python
msft = yf.Ticker("MSFT")
msft.history(..., proxy="PROXY_SERVER")

View File

@@ -0,0 +1,41 @@
******************************
Smarter Scraping with Caching
******************************
Install the `nospam` package to cache API calls and reduce spam to Yahoo:
.. code-block:: bash
pip install yfinance[nospam]
To use a custom `requests` session, pass a `session=` argument to
the Ticker constructor. This allows for caching calls to the API as well as a custom way to modify requests via the `User-agent` header.
.. code-block:: python
import requests_cache
session = requests_cache.CachedSession('yfinance.cache')
session.headers['User-agent'] = 'my-program/1.0'
ticker = yf.Ticker('MSFT', session=session)
# The scraped response will be stored in the cache
ticker.actions
Combine `requests_cache` with rate-limiting to avoid triggering Yahoo's rate-limiter/blocker that can corrupt data.
.. code-block:: python
from requests import Session
from requests_cache import CacheMixin, SQLiteCache
from requests_ratelimiter import LimiterMixin, MemoryQueueBucket
from pyrate_limiter import Duration, RequestRate, Limiter
class CachedLimiterSession(CacheMixin, LimiterMixin, Session):
pass
session = CachedLimiterSession(
limiter=Limiter(RequestRate(2, Duration.SECOND*5)), # max 2 requests per 5 seconds
bucket_class=MemoryQueueBucket,
backend=SQLiteCache("yfinance.cache"),
)

0
docs/.nojekyll Normal file
View File

BIN
docs/_images/branches.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,109 @@
********************************
Contributiong to yfinance
********************************
`yfinance` relies on the community to investigate bugs and contribute code. Heres how you can help:
Contributing
------------
1. Fork the repository on GitHub.
2. Clone your forked repository:
.. code-block:: bash
git clone https://github.com/your-username/yfinance.git
3. Create a new branch for your feature or bug fix:
.. code-block:: bash
git checkout -b feature-branch-name
4. Make your changes, commit them, and push your branch to GitHub. To keep the commit history and `network graph <https://github.com/ranaroussi/yfinance/network>`_ compact:
Use short summaries for commits
.. code-block:: shell
git commit -m "short summary" -m "full commit message"
**Squash** tiny or negligible commits with meaningful ones.
.. code-block:: shell
git rebase -i HEAD~2
git push --force-with-lease origin <branch-name>
5. Open a pull request on the `yfinance` GitHub page.
For more information, see the `Developer Guide <https://github.com/ranaroussi/yfinance/discussions/1084>`_.
Branches
---------
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
.. image:: assets/branches.png
:alt: Branching Model
`Inspiration <https://miro.medium.com/max/700/1*2YagIpX6LuauC3ASpwHekg.png>`_
- **dev**: New features and some bug fixes are merged here. This branch allows collective testing, conflict resolution, and further stabilization before merging into the stable branch.
- **main**: Stable branch where PIP releases are created.
By default, branches target **main**, but most contributions should target **dev**.
**Exceptions**:
Direct merges to **main** are allowed if:
- `yfinance` is massively broken
- Part of `yfinance` is broken, and the fix is simple and isolated
Unit Tests
----------
Tests are written using Pythons `unittest` module. Here are some ways to run tests:
- **Run all price tests**:
.. code-block:: shell
python -m unittest tests.test_prices
- **Run a subset of price tests**:
.. code-block:: shell
python -m unittest tests.test_prices.TestPriceRepair
- **Run a specific test**:
.. code-block:: shell
python -m unittest tests.test_prices.TestPriceRepair.test_ticker_missing
- **Run all tests**:
.. code-block:: shell
python -m unittest discover -s tests
Rebasing
--------------
If asked to move your branch from **main** to **dev**:
1. Ensure all relevant branches are pulled.
2. Run:
.. code-block:: shell
git checkout <your-branch>
git rebase --onto dev main <branch-name>
git push --force-with-lease origin <branch-name>
Running the GitHub Version of yfinance
--------------------------------------
To download and run a GitHub version of `yfinance`, refer to `GitHub discussion <https://github.com/ranaroussi/yfinance/discussions/1080>`_

View File

@@ -0,0 +1,46 @@
*************************************
Contribution to the documentation
*************************************
.. contents:: Documentation:
:local:
About documentation
------------------------
* yfinance documentation is written in reStructuredText (rst) and built using Sphinx.
* The documentation file is in `doc/source/..`.
* Most of the notes under API References read from class and methods docstrings. These documentations, found in `doc/source/reference/api` is autogenerated by Sphinx and not included in git.
Building documentation locally
-------------------------------
To build the documentation locally, follow these steps:
1. **Install Required Dependencies**:
* Make sure `Sphinx` and any other dependencies are installed. If a `requirements.txt` file is available, you can install dependencies by running:
.. code-block:: console
pip install -r requirements.txt
2. **Build with Sphinx**:
* After dependencies are installed, use the sphinx-build command to generate HTML documentation.
* Go to `doc/` directory Run:
.. code-block:: console
make clean && make html
3. **View Documentation Locally**:
* Open `doc/build/html/index.html` in the browser to view the generated documentation.
Building documentation on main
-------------------------------
The documentation updates are built on merge to `main` branch. This is done via GitHub Actions workflow based on `/yfinance/.github/workflows/deploy_doc.yml`.
1. Reivew the changes locally and push to `dev`.
2. When `dev` gets merged to `main`, GitHub Actions workflow is automated to build documentation.

View File

@@ -0,0 +1,9 @@
Development
===============================
.. toctree::
:maxdepth: 1
contributing
documentation
reporting_bug

View File

@@ -0,0 +1,5 @@
********************************
Reporting a Bug
********************************
Open a new issue on our `GitHub <https://github.com/ranaroussi/yfinance/issues>`_.

View File

@@ -0,0 +1,9 @@
Getting Started
===============
.. toctree::
:maxdepth: 1
installation
quick_start
legal

View File

@@ -0,0 +1,17 @@
********************
Installation Guide
********************
Install `yfinance` using `pip`:
.. code-block:: bash
$ pip install yfinance --upgrade --no-cache-dir
To install with optional dependencies, replace `optional` with: `nospam` for `caching-requests <https://github.com/ranaroussi/yfinance?tab=readme-ov-file#smarter-scraping>`_, `repair` for `price repair <https://github.com/ranaroussi/yfinance/wiki/Price-repair>`_, or `nospam`, `repair` for both:
.. code-block:: bash
$ pip install "yfinance[optional]"
For required dependencies, check out the `requirements file <./requirements.txt>`_, and for all dependencies, see the `setup.py file <./setup.py#L62>`_.

View File

@@ -0,0 +1,12 @@
********************
Legal Information
********************
yfinance is distributed under the Apache Software License. See the `LICENSE.txt <../../../../LICENSE.txt>`_ file for details.
Again, yfinance is **not** affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes.
Refer to Yahoo!'s terms of use:
- `API Terms <https://policies.yahoo.com/us/en/yahoo/terms/product-atos/apiforydn/index.htm>`_
- `Yahoo Terms <https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html>`_

View File

@@ -0,0 +1,30 @@
********************
Quick Start
********************
The Ticker module allows you to access ticker data in a more Pythonic way:
.. code-block:: python
import yfinance as yf
msft = yf.Ticker("MSFT")
# get all stock info
msft.info
# get historical market data
hist = msft.history(period="1mo")
# show actions (dividends, splits, capital gains)
msft.actions
msft.dividends
msft.splits
To work with multiple tickers, use:
.. code-block:: python
tickers = yf.Tickers('msft aapl goog')
tickers.tickers['MSFT'].info
tickers.tickers['AAPL'].history(period="1mo")

View File

@@ -0,0 +1,30 @@
yfinance documentation
==============================================
Download Market Data from Yahoo! Finance's API
------------------------------------------------
.. admonition:: IMPORTANT LEGAL DISCLAIMER
**Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.**
yfinance is **not** affiliated, endorsed, or vetted by Yahoo, Inc. It's
an open-source tool that uses Yahoo's publicly available APIs, and is
intended for research and educational purposes.
**You should refer to Yahoo!'s terms of use**
(`here <https://policies.yahoo.com/us/en/yahoo/terms/product-atos/apiforydn/index.htm>`__),
(`here <https://legal.yahoo.com/us/en/yahoo/terms/otos/index.html>`__),
and (`here <https://policies.yahoo.com/us/en/yahoo/terms/index.htm>`__)
for details on your rights to use the actual data downloaded.
Remember - the Yahoo! finance API is intended for personal use only.
.. toctree::
:maxdepth: 3
:hidden:
:titlesonly:
getting_started/index
user_guide/index
reference/index
development/index

View File

@@ -0,0 +1,6 @@
yfinance.EquityQuery.valid\_eq\_operand\_map
============================================
.. currentmodule:: yfinance
.. autoproperty:: EquityQuery.valid_eq_operand_map

View File

@@ -0,0 +1,6 @@
yfinance.EquityQuery.valid\_operand\_fields
===========================================
.. currentmodule:: yfinance
.. autoproperty:: EquityQuery.valid_operand_fields

View File

@@ -0,0 +1,6 @@
yfinance.Industry.key
=====================
.. currentmodule:: yfinance
.. autoproperty:: Industry.key

View File

@@ -0,0 +1,6 @@
yfinance.Industry.name
======================
.. currentmodule:: yfinance
.. autoproperty:: Industry.name

View File

@@ -0,0 +1,6 @@
yfinance.Industry.overview
==========================
.. currentmodule:: yfinance
.. autoproperty:: Industry.overview

View File

@@ -0,0 +1,6 @@
yfinance.Industry.research\_reports
===================================
.. currentmodule:: yfinance
.. autoproperty:: Industry.research_reports

View File

@@ -0,0 +1,6 @@
yfinance.Industry.sector\_key
=============================
.. currentmodule:: yfinance
.. autoproperty:: Industry.sector_key

View File

@@ -0,0 +1,6 @@
yfinance.Industry.sector\_name
==============================
.. currentmodule:: yfinance
.. autoproperty:: Industry.sector_name

View File

@@ -0,0 +1,6 @@
yfinance.Industry.symbol
========================
.. currentmodule:: yfinance
.. autoproperty:: Industry.symbol

View File

@@ -0,0 +1,6 @@
yfinance.Industry.ticker
========================
.. currentmodule:: yfinance
.. autoproperty:: Industry.ticker

View File

@@ -0,0 +1,6 @@
yfinance.Industry.top\_companies
================================
.. currentmodule:: yfinance
.. autoproperty:: Industry.top_companies

View File

@@ -0,0 +1,6 @@
yfinance.Industry.top\_growth\_companies
========================================
.. currentmodule:: yfinance
.. autoproperty:: Industry.top_growth_companies

View File

@@ -0,0 +1,6 @@
yfinance.Industry.top\_performing\_companies
============================================
.. currentmodule:: yfinance
.. autoproperty:: Industry.top_performing_companies

View File

@@ -0,0 +1,6 @@
yfinance.Screener.body
======================
.. currentmodule:: yfinance
.. autoproperty:: Screener.body

View File

@@ -0,0 +1,6 @@
yfinance.Screener.predefined\_bodies
====================================
.. currentmodule:: yfinance
.. autoproperty:: Screener.predefined_bodies

View File

@@ -0,0 +1,6 @@
yfinance.Screener.response
==========================
.. currentmodule:: yfinance
.. autoproperty:: Screener.response

View File

@@ -0,0 +1,6 @@
yfinance.Sector.industries
==========================
.. currentmodule:: yfinance
.. autoproperty:: Sector.industries

View File

@@ -0,0 +1,6 @@
yfinance.Sector.key
===================
.. currentmodule:: yfinance
.. autoproperty:: Sector.key

View File

@@ -0,0 +1,6 @@
yfinance.Sector.name
====================
.. currentmodule:: yfinance
.. autoproperty:: Sector.name

View File

@@ -0,0 +1,6 @@
yfinance.Sector.overview
========================
.. currentmodule:: yfinance
.. autoproperty:: Sector.overview

View File

@@ -0,0 +1,6 @@
yfinance.Sector.research\_reports
=================================
.. currentmodule:: yfinance
.. autoproperty:: Sector.research_reports

View File

@@ -0,0 +1,6 @@
yfinance.Sector.symbol
======================
.. currentmodule:: yfinance
.. autoproperty:: Sector.symbol

View File

@@ -0,0 +1,6 @@
yfinance.Sector.ticker
======================
.. currentmodule:: yfinance
.. autoproperty:: Sector.ticker

View File

@@ -0,0 +1,6 @@
yfinance.Sector.top\_companies
==============================
.. currentmodule:: yfinance
.. autoproperty:: Sector.top_companies

View File

@@ -0,0 +1,6 @@
yfinance.Sector.top\_etfs
=========================
.. currentmodule:: yfinance
.. autoproperty:: Sector.top_etfs

View File

@@ -0,0 +1,6 @@
yfinance.Sector.top\_mutual\_funds
==================================
.. currentmodule:: yfinance
.. autoproperty:: Sector.top_mutual_funds

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.actions
=======================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.actions

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.analyst\_price\_targets
=======================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.analyst_price_targets

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.balance\_sheet
==============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.balance_sheet

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.balancesheet
============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.balancesheet

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.basic\_info
===========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.basic_info

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.calendar
========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.calendar

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.capital\_gains
==============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.capital_gains

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.cash\_flow
==========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.cash_flow

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.cashflow
========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.cashflow

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.dividends
=========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.dividends

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.earnings
========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.earnings

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.earnings\_dates
===============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.earnings_dates

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.earnings\_estimate
==================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.earnings_estimate

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.earnings\_history
=================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.earnings_history

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.eps\_revisions
==============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.eps_revisions

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.eps\_trend
==========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.eps_trend

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.fast\_info
==========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.fast_info

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.financials
==========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.financials

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.funds\_data
===========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.funds_data

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.growth\_estimates
=================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.growth_estimates

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.history\_metadata
=================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.history_metadata

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.income\_stmt
============================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.income_stmt

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.incomestmt
==========================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.incomestmt

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.info
====================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.info

View File

@@ -0,0 +1,6 @@
yfinance.Ticker.insider\_purchases
==================================
.. currentmodule:: yfinance
.. autoproperty:: Ticker.insider_purchases

Some files were not shown because too many files have changed in this diff Show More