Skip to main content

Stock Manager

Project description

stockmanager

Manager, Analyze, Stimulate stock information.

.. image:: https://travis-ci.com/wiccy46/stockmanager.svg?branch=master :target: https://travis-ci.com/wiccy46/stockmanager

Installation

Using pip::

pip install stockmanager

Example

Load a stock info::

from stockmanager import Ticker

mystock = Ticker(symbol='MSFT')  # Give a ticker string

# result is a pandas DataFrame
info_pd = mystock.get_price(start='2020-03-01', end='2020-03-19')

# Or use period and interval
# valid period: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
# valid interval: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
info_pd = mystock.get_price(period='1mo', interval='1d')

earnings = mystock.get_earings(freq='yearly')
cashflow = mystock.get_cashflow(freq='quarterly')
balancesheet = mystock.get_balancesheet()

Other attributes: institutional_holders, major_holders, mutual_fund_holders, sustainability, company_information,

Visualization:

from stockmanager import Ticker, visualization

mystock = Ticker(symbol='MSFT')  # Give a ticker string
# result is a pandas DataFrame
info_pd = mystock.get_price(start='2020-03-01', end='2020-03-19')

# Accept matplotlib and plotly (interactive) backend 
visualization.plot_price(info_pd)

# or use plotly
visualization.plot_price(info_pd, backend='plotly')

Portfolio is a class that let you add holdings of certain stocks and add trade records. It has two main attributes,

  • Portfolio.summary as your holding summary
  • Portfolio.record as a table of all the trade record.

Example:

from stockmanager import Portfolio

myportfolio = Portfolio()
myportfolio.add('AAPL', holdings=200)
myportfolio.add('ZM', holdings=200)
myportfolio.summary # This is a DataFrame view of your holdings.

# typ is buy or sell, price by default will try to get the current price
# update_summary will modified self.summary according to amount. 
myportfolio.trade(typ='buy'|'sell', symbol='AAPL', amount=20,
                  prince=200., update_summary=True)

myportfolio.save(filepath='./', summary_name='portfolio',
                 record_name='record', format='csv')

myportfolio.load(summary_path='./portfolio.csv', record_path='./record.csv')

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

stockmanager-0.1.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

stockmanager-0.1.0-py2.py3-none-any.whl (23.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file stockmanager-0.1.0.tar.gz.

File metadata

  • Download URL: stockmanager-0.1.0.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for stockmanager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95e5ce83e0ab0c3bef4804de47ef06c007af8013847be9e7a74bdc1e1c7d33e5
MD5 ff54985a5f26b19ebd5002bb6af72138
BLAKE2b-256 022ecf4e2bd868d090de154b08ea9113d66aa24a0c140bec3bf7c9683bc1f5ae

See more details on using hashes here.

File details

Details for the file stockmanager-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: stockmanager-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for stockmanager-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cd6e32c9a98b2d70e72512d23e7d7898d29d5d08432d4c7120f8d186563b539f
MD5 98c8fa8b3a0521b7bc8afd21213357c0
BLAKE2b-256 3cd7f4d2a3046db0d4fd305364d4ef7227421889b6a01e43a6299b007b14658c

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