Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpguthrie/yahooquery
Python wrapper for an unofficial Yahoo Finance API
https://github.com/dpguthrie/yahooquery
api api-wrapper finance market-data pandas python stock-data stock-market yahoo-finance yahoo-finance-api
Last synced: 3 days ago
JSON representation
Python wrapper for an unofficial Yahoo Finance API
- Host: GitHub
- URL: https://github.com/dpguthrie/yahooquery
- Owner: dpguthrie
- License: mit
- Created: 2019-12-13T00:29:16.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-02T18:27:39.000Z (10 months ago)
- Last Synced: 2024-05-18T01:02:58.972Z (8 months ago)
- Topics: api, api-wrapper, finance, market-data, pandas, python, stock-data, stock-market, yahoo-finance, yahoo-finance-api
- Language: Python
- Homepage: https://yahooquery.dpguthrie.com
- Size: 9.57 MB
- Stars: 743
- Watchers: 28
- Forks: 130
- Open Issues: 57
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-quant - yahooquery - Python interface for retrieving data through unofficial Yahoo Finance API. (Python / Data Sources)
README
Python wrapper for an unofficial Yahoo Finance API
---
**Documentation**: https://yahooquery.dpguthrie.com
**Interactive Demo**: https://yahooquery.streamlit.app/
**Source Code**: https://github.com/dpguthrie/yahooquery
**Blog Post**: https://towardsdatascience.com/the-unofficial-yahoo-finance-api-32dcf5d53df
---
## Overview
Yahooquery is a python interface to unofficial Yahoo Finance API endpoints. The package allows a user to retrieve nearly all the data visible via the Yahoo Finance front-end.
Some features of yahooquery:
- **Fast**: Data is retrieved through API endpoints instead of web scraping. Additionally, asynchronous requests can be utilized with simple configuration
- **Simple**: Data for multiple symbols can be retrieved with simple one-liners
- **User-friendly**: Pandas Dataframes are utilized where appropriate
- **Premium**: Yahoo Finance premium subscribers are able to retrieve data available through their subscription## Requirements
Python 2.7, 3.5+
- [Pandas](https://pandas.pydata.org) - Fast, powerful, flexible and easy to use open source data analysis and manipulation tool
- [Requests](https://requests.readthedocs.io/en/master/) - The elegant and simple HTTP library for Python, built for human beings.
- [Requests-Futures](https://github.com/ross/requests-futures) - Asynchronous Python HTTP Requests for Humans### Yahoo Finance Premium Subscribers
- [Selenium](https://www.selenium.dev/selenium/docs/api/py/) - Web browser automation
Selenium is only utilized to login to Yahoo, which is done when the user passes certain keyword arguments. Logging into Yahoo enables users who are subscribers to Yahoo Finance Premium to retrieve data only accessible to premium subscribers.
## Installation
If you're a Yahoo Finance premium subscriber and would like to retrieve data available through your subscription, do the following:
```bash
pip install yahooquery[premium]
```Otherwise, omit the premium argument:
```bash
pip install yahooquery
```## Example
The majority of the data available through the unofficial Yahoo Finance API is related to a company, which is represented in yahooquery as a `Ticker`. You can instantiate the `Ticker` class by passing the company's ticker symbol. For instance, to get data for Apple, Inc., pass `aapl` as the first argument to the `Ticker` class:
```python
from yahooquery import Tickeraapl = Ticker('aapl')
aapl.summary_detail
```## Multiple Symbol Example
The `Ticker` class also makes it easy to retrieve data for a list of symbols with the same API. Simply pass a list of symbols as the argument to the `Ticker` class.
```python
from yahooquery import Tickersymbols = ['fb', 'aapl', 'amzn', 'nflx', 'goog']
faang = Ticker(symbols)
faang.summary_detail
```## License
This project is licensed under the terms of the MIT license.