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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file stockdex-1.0.1.tar.gz.

File metadata

  • Download URL: stockdex-1.0.1.tar.gz
  • Upload date:
  • Size: 7.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for stockdex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8f75870c0f2a600119c35aa27df3303310058638e0019160870650a86a5b0dda
MD5 b49cc8882572427f62502ce71ee4ab7d
BLAKE2b-256 1e2e0925bbbdb83c20e1f510dd6fa97c2f62a292d3a8991cac5e62e30bd7f32c

See more details on using hashes here.

File details

Details for the file stockdex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: stockdex-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for stockdex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbb1de0d8a920e21fe04835a80f6836fb7207528bd8a273d312d8f24c87c330f
MD5 37a53f5275736a60927c00f5194f094c
BLAKE2b-256 69ac55c1e6f0cc16cbc032040c6d17276e70c14a31acb94fc37bf95a7168acbc

See more details on using hashes here.

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