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

Uploaded Source

Built Distribution

financelite-0.1.7-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file financelite-0.1.7.tar.gz.

File metadata

  • Download URL: financelite-0.1.7.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.5

File hashes

Hashes for financelite-0.1.7.tar.gz
Algorithm Hash digest
SHA256 cda88a7bc96c321630921504dbb4c7ea19aa1091a4530b78a081f98e827ed846
MD5 facf3a37addaa3bcdf889fdadfba9400
BLAKE2b-256 dffbbb40775917b8455e907a9be8f209194c89abac907ffc854602e275aa3936

See more details on using hashes here.

File details

Details for the file financelite-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: financelite-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.5

File hashes

Hashes for financelite-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0df7fe49ed792eac5889829857eab346f85a12d495c964ccbae49f74f78a777e
MD5 1f1c0d0e47292fbe9aae533fec094f2c
BLAKE2b-256 c3570d4815a34bb4dd418223eec378e2f8eb2c1244dc56dd016546fbc7ea8b30

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