Skip to main content

A package to get stock data from Yahoo Finance

Project description

Publish Python Package to PyPI PyPI version

Code style: black Code style: isort flake8

Documentation Status

Stockdex Logo

Stockdex

Stockdex is a Python package that provides a simple interface to access financial data from various soruces and plotting capabilities using Plotly.


Advantages of Stockdex over similar packages

  • Various data sources: Stockdex provides data from Yahoo Finance API and website, Digrin, Macrotrends, and JustETF (for EU ETFs).

  • Numerous data categories: Stockdex provides various data including financial statements, earnings, dividends, stock splits, list of key executives, major shareholders, and many more.

  • Historical data: Stockdex provides a wide time range of data, e.g. Digrin and Macrotrends sources, which provide data ranging from 4 years to historical data.

  • plotting capabilities (new feature): Stockdex provides plotting financial data using bar, line, and sanky plots. Multiple plots can be combined in dash app.


Installation

Install the package using pip:

pip install stockdex -U

Usage

For detailed info about usage of the package and its functions including plotting and dash app, check out the this part of the readme.

In general, to access main functions, The Ticker object should be created with the ticker of the stock as an argument. An example of creating a Ticker object is shown below:

from stockdex import Ticker

ticker = Ticker(ticker="AAPL")

Data from Yahoo Finance, Digrin, and Macrotrends:

The Ticker object provides data from Yahoo Finance API and website, Digrin, and Macrotrends. Below are some of the data that can be retrieved from these sources (more detailed info with output can be found here).

Raw data:

from stockdex import Ticker
from datetime import datetime

ticker = Ticker(ticker="AAPL")

# Price data (use range and dataGranularity to make range and granularity more specific) from Yahoo Finance API
price = ticker.yahoo_api_price(range='1y', dataGranularity='1d')

# plot financial data using Plotly
ticker = Ticker(ticker="MSFT")
ticker.plot_yahoo_api_financials(group_by="field")

# Complete historical data of the stock in certain categories from digrin website
dividend = ticker.digrin_dividend

# Financial data from macrotrends website
income_statement = ticker.macrotrends_income_statement

# Summary including general financial information from Yahoo Finance website
summary = ticker.yahoo_web_summary

EU ETF data from justETF (web scraping):

For EU ETFS, the isin and security_type should be passed to the Ticker object. The isin is the International Securities Identification Number of the ETF and the security_type should be set to etf.

from stockdex import Ticker

etf = Ticker(isin="IE00B4L5Y983", security_type="etf")

etf_general_info = etf.justetf_general_info


Check out sphinx documentation here for more information about the package.

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

stockdex-1.0.1.tar.gz (7.4 MB view hashes)

Uploaded Source

Built Distribution

stockdex-1.0.1-py3-none-any.whl (7.4 MB view hashes)

Uploaded Python 3

Supported by

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