Stockdex is a Python package that provides a simple interface to access financial data from various soruces and plotting capabilities using Plotly.
-
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.
Install the package using pip:
pip install stockdex -U --no-cache-dir
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")
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).
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
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.