Skip to main content

A lightweight stock information package for simple tasks

Project description

financelite

financelite is a lightweight stock information tool that takes every complicated features out.
It only focuses on providing simple and intuitive, yet informative stock information.

Currently, financelite is in a rapidly-evolving state. While I'll try to stay within the boundaries, please understand your implementation may have to change in the future upgrades.

Installation

pip install financelite

Example Usage

News

from financelite import News
from financelite.exceptions import NoNewsFoundException

news = News()
try:
    news.get_news(ticker="gme", count=5)
    # returns 5 GME-related news
except NoNewsFoundException:
    # raised if there aren't any news associated with the ticker.
    pass

Stock

from financelite import Stock
from financelite.exceptions import DataRequestException

stock = Stock(ticker="gme")

try:
    stock.get_chart(interval="1d", range="5d")
    # returns statistics for 5 days, with 1 day interval

    stock.get_live()
    # returns GME's live price and currency
    
    stock.get_hist(data_range="1wk")
    # returns 1 week worth of closed price data
except DataRequestException:
    # raised if ticker, interval, or range values are wrong
    pass
except ValueError:
    # raised if get_hist's days is <= 1 or not int
    pass

Group

from financelite import Group, Stock
from financelite.exceptions import TickerNotInGroupException, DataRequestException, \
    ItemNotValidException

# You can add tickers to the group like this
group = Group()
group.add_ticker("gme")  # it takes in str value, then creates a Stock object with the ticker.
group.add_ticker("bb")
group.add_ticker("amc")

# or you can initialize the group with Stock objects
bb = Stock(ticker="bb")
gme = Stock(ticker="gme")
group = Group([bb, gme])

group.list_tickers()
# returns list of tickers represented as strings

try: 
    group.remove_ticker("ac.to")
except TickerNotInGroupException:
    # raised if ticker does not exist within the group
    pass

try:
    group.get_quotes(cherrypicks=["symbol", "shortName", "regularMarketPrice"])
    # returns a dictionary with only those keys
    
    group.get_quotes(cherrypicks=["symbol", "shortName", "regularMarketPrice"], exclude=True)
    # returns a dictionary with keys except these keys

except DataRequestException:
    # raised if the data request was not successful. Usually means invalid ticker.
    pass
except ItemNotValidException:
    # raised if any item in the cherrypicks list is invalidd
    pass

Special Thanks

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

financelite-0.1.7.tar.gz (18.3 kB view hashes)

Uploaded Source

Built Distribution

financelite-0.1.7-py3-none-any.whl (19.7 kB 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