Retreive data (quote, historical, financial, statistics) from Yahoo Finance.
Project description
yahoo-finance-data (Alpha-version)
The omnipotent Yahoo-Finance data retreiver
yahoo-finance-data (yfd) is a package for the retreival of data from Yahoo Finance. It makes use of both scraping and query calls. The yahoo-finance-data package is intended to be simple to use. Its usage is summarized in two steps.
- Create specialized data retreival objects
- Retreive data in a standardized dictionary format
Features
The asset classes currently supported are: Stocks. In the future support will be added for Options, Bonds and Crypto.
Data Types
The following data may be retreived.
- Quote
- Historical (price, dividends, splits)
- Financials
- Cash-Flow statement
- Balance-Sheet statement
- Key-Statistics
Installation
pip install yahoo-finance-data
Usage
- Retreival of time series data (YahooFinanceTimeSeriesByQueryScraper). -Availabe function types: ['quote', 'dividends', 'splits'] -Available frequency types: ['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']
from datetime import datetime
from yfd import YahooFinanceTimeSeriesByQueryScraper
ticker = 'AAPL'
startDate = datetime.strptime('2020-01-01', '%Y-%m-%d')
endDate = datetime.strptime('2021-04-01', '%Y-%m-%d')
ysfds = YahooFinanceTimeSeriesByQueryScraper(ticker, function = 'quote', startTime = startDate, endTime = endDate, frequency = '1d')
ysfds.GetData()
resultAsDictionary = ysfds.GetResult()
- Quote scraper (YahooQuoteInfoScraper) -Scrapes quote information: Name, exchange and price.
from yfd import YahooQuoteInfoScraper
ticker = 'AAPL'
yqis = YahooQuoteInfoScraper(ticker, function='quote')
yqis.GetData()
resultAsDictionary = yqis.GetResult()
- Financials scraper (YahooFinanceStaticFinancialDataScraper) -Scrapes financial data, the available data retreival types are: ['cash-flow', 'balance-sheet', 'financials', 'key-statistics']
from yfd import YahooFinanceStaticFinancialDataScraper
ticker = 'AAPL'
ysfds = YahooFinanceStaticFinancialDataScraper(ticker = ticker, yahooFunction = 'financials')
ysfds.GetData()
resultAsDictionary = ysfds.GetResult()
Dependencies
yahoo-finance-data uses a number of 3rd party projects:
- [certifi] - Validating the trustworthiness of SSL certificates.
- [urllib3] - A powerful, user-friendly HTTP client for Python.
- [beautifulsoup4] - A library which makes it easy to scrape information from web pages.
- [datetime] - Standardize time management.
yahoo-finance-data is itself an open source project with a public repository on GitHub.
License
MIT
*Free Software
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file yahoo-finance-data-0.0.9.tar.gz
.
File metadata
- Download URL: yahoo-finance-data-0.0.9.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8777b68d22f2cd02405247d23d17423f9ad39db13eacd0ec1972647ef62cf618 |
|
MD5 | 952e9ec100e3971e3bc796f9e8ce6486 |
|
BLAKE2b-256 | 3396f8937c186210287b10ebc60150d721eb5b9b4d09de75105ba38893d94c84 |