YFS
Yahoo Finance Scraper with a WYSIWYG approach.
Want to scrape data from the summary page use the get_summary_page function. Want to scrape the summary pages of a list of symbols use the get_multiple_summary_pages function. The returned object can be serialized with .json, .dict, and depending on the object .dataframe methods. Each function can accept a proxy to help avoid rate limiting. In fact in the future you can install requests-whaor ANOTHER WORK IN PROGRESS which supplies a rotating proxy to bypass rate limits.
Before you start please note adding historical data to this API is not a priority. At some point I will get around to it. My main focus are options, quote information and symbol lookup. So please do not raise issues about historical data.
Features
- Company and Symbol lookup
- Summary Page
- Option Chains
- Statistics Page
>> To the documentation.
Quick Start
Prereqs
- Python ^3.8
Install with pip
pip install yfs
Install with poetry
poetry add yfs
How to scrape multiple summary pages from yahoo finance.
from yfs import get_multiple_summary_pages
search_items = ["Apple", "tsla", "Microsoft", "AMZN"]
summary_results = get_multiple_summary_pages(search_items)
for page in summary_results:
print(page.json(indent=4))
break # To shorten up the quick-start output.
COLUMNS = [
"close",
"change",
"percent_change",
"average_volume",
"market_cap",
"earnings_date",
]
print(summary_results.dataframe[COLUMNS])
Output
➜ python3 quick_start_example.py
Downloading Summary Data... 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:03<00:00, 1.19 symbols/s]{
"symbol": "AAPL",
"name": "Apple Inc.",
"quote": {
"name": "Apple Inc.",
"close": 113.02,
"change": -3.77,
"percent_change": -3.23
},
"open": 112.89,
"high": 112.22,
"low": 115.37,
"close": 113.02,
"change": -3.77,
"percent_change": -3.23,
"previous_close": 116.79,
"bid_price": 112.58,
"bid_size": 800,
"ask_price": 112.77,
"ask_size": 3000,
"fifty_two_week_low": 137.98,
"fifty_two_week_high": 53.15,
"volume": 144711986,
"average_volume": 172065562,
"market_cap": 1933000000000,
"beta_five_year_monthly": 1.28,
"pe_ratio_ttm": 34.29,
"eps_ttm": 3.3,
"earnings_date": "2020-10-28",
"forward_dividend_yield": 0.82,
"forward_dividend_yield_percentage": 0.7,
"exdividend_date": "2020-08-07",
"one_year_target_est": 119.24
}
close change percent_change average_volume market_cap earnings_date
symbol
AAPL 113.02 -3.77 -3.23 172065562 1933000000000 2020-10-28
AMZN 3125.00 -96.26 -2.99 5071692 1565000000000 2020-10-29
MSFT 206.19 -6.27 -2.95 34844893 1560000000000 2020-10-21
TSLA 415.09 -33.07 -7.38 80574089 386785000000 2020-10-21
Next step fuzzy search examples
TODO
- More testing
- More Docs
- More examples
- WHAOR Example
- Profile Page
- Financials Page
- Analysis Page
- Holders page
- Sustainability Page
- Historical Page
- Chart Page
- Conversations Page maybe ¯_(ツ)_/¯
Contact Information
Telegram = Twitter = Tradingview = Discord = @dgnsrekt
Email = dgnsrekt@pm.me
Metadata
Release files for yfs 0.3.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 |
|---|---|---|---|---|
| yfs-0.3.2.tar.gz | 25.1 kB | Without provenance | Details for yfs-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yfs-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for yfs-0.3.2-py3-none-any.whl |
Total release size: 53.6 kB
Release files / yfs-0.3.2.tar.gz
| Download URL | yfs-0.3.2.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a901e89dae064a483299a11943b675c05221d8700efbdd4024497ac6670c214
|
|
BLAKE2b-256 checksum How to use checksums |
8b9208f2e454407570d4623342a258be2718d8d142d403fa3f089e15e385a404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-7634-generic
|
Release files / yfs-0.3.2-py3-none-any.whl
| Download URL | yfs-0.3.2-py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
beec88c4b500e683eb0b5f5ca74e188b877a33c129bdc2a126d99ba609241cf6
|
|
BLAKE2b-256 checksum How to use checksums |
4bc23d607592958e6de90ca1865cdd0d7bf1d45df9e7fb6632bbc976a3a7bbd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-7634-generic
|
Security for yfs 0.3.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.