Skip to main content

Retrieve nearly all data from Yahoo Finance for one or more ticker symbols

Project description

Python wrapper for an unofficial Yahoo Finance API

Build Status Coverage Package version Downloads


Documentation: https://yahooquery.dpguthrie.com

Interactive Demo: https://yahooquery-streamlit.herokuapp.com

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 - Fast, powerful, flexible and easy to use open source data analysis and manipulation tool

  • Requests - The elegant and simple HTTP library for Python, built for human beings.

  • Requests-Futures - Asynchronous Python HTTP Requests for Humans

  • Selenium - 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

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:

from yahooquery import Ticker

aapl = Ticker('aapl')

aapl.summary_detail

Multple 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.

from yahooquery import Ticker

symbols = ['fb', 'aapl', 'amzn', 'nflx', 'goog']

faang = Ticker(symbols)

faang.summary_detail

License

This project is licensed under the terms of the MIT license.

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

yahooquery-2.2.7.tar.gz (44.0 kB view details)

Uploaded Source

File details

Details for the file yahooquery-2.2.7.tar.gz.

File metadata

  • Download URL: yahooquery-2.2.7.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

File hashes

Hashes for yahooquery-2.2.7.tar.gz
Algorithm Hash digest
SHA256 27b7baea3425d62e718925a4d3b23249cf72e21cccc47b8b5f8a0ca44fb9349d
MD5 23b91efcf7a370d7130e12e0d30fcbca
BLAKE2b-256 7c4dfe473a64fcd0b13a3278ed8e215de0db699e6d5612f6c5f2988e4833146d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page