A command line utility for tracking a stock market portfolio. Primarily featuring high resolution braille graphs.

Overview

cliStocksTracker

GitHub GitHub contributors GitHub last commit

A command line stock market / portfolio tracker originally insipred by Ericm's Stonks program, featuring unicode for incredibly high detailed graphs even in a terminal.

image

Installation

This project is still in Beta, so there is no executable packaged with the project.

Requirements:

  • Python >= 3.6.9
  • plotille >= 3.7.2
  • numpy >= 1.19.5
  • yfinance >= 0.1.55
  • pytz >= 2021.1
  • colorama >= 0.4.4

Manual

$ git clone https://github.com/ConradSelig/cliStocksTracker
$ cd cliStocksTracker
$ python3 -m pip install -r requirements.txt

Usage

$ python3 cliStocksTracker.py

Configuration

cliStocksTracker relies on two config files, "config" and "stocks_config".

config

frame:
  width: [ graph width ]
  height: [ graph height ]
kwargs:
  independent_graphs: [ True | False ]
  timezone: [ pytz timezone stamp (ex. "America/New_York", "Asia/Shanghai", etc) ]
  round_mode: [math | down]

If indepentant_graphs is True, all the given stocks will be graphed on the same plot, otherwise all of the given stocks will be printed on independent plots. There is currently no grouping of stocks, either manual or automatic (planned).

All keys in the config file are required.

stocks_config

[ stock symbol ]:
  graph: [ True | False ]
  owned: [ float ]
  bought_at: [ float ]
[ stock symbol ]:
  graph: [ True | False ]
  owned: [ float ]
  bought_at: [ float ]
...

Each stock symbol has three additional config settings:

  1. "graph": Determins if a graph is plotted of this symbol
  2. "owned": Count of the number of stocks owned of this symbol
  3. "bought_at": Price the stocks we're originally bought at, this is used to calculate portfolio delta.

There is currently no support for stocks of the same label being bought at different prices (planned).

There is currently no support for custom selection of symbol colors within a graph (planned).

All keys in the stocks_config file are optional.

Comments
  • Add manual color selection to stocks

    Add manual color selection to stocks

    This is something that was implemented before #2 (re-architecture), so looking back at this commit will help re-implement this feature: 7373b50eddf0b19030c19646b6b1c6020e231664

    Color selection should be available by both stocks_config and by cli arguments.

    good first issue 
    opened by ConradSelig 29
  • Rounding modes

    Rounding modes

    Currently this project uses Pythons default round() function, but I found that my stock broker (I use Schwab) always rounds down, which means that the numbers this program outputs can be incorrect.

    Two rounding modes we should support:

    • "Math" rounding: 1.4 -> 1, 1.5 -> 2
    • "Down" rounding: 1.4 ->1, 1.5 -> 1

    I suppose we could support "Up" rounding as well, but lets be honest - nobody would use that, which is why I didn't bother listing it.

    good first issue 
    opened by ConradSelig 12
  • Command line configuration / configuration overhaul

    Command line configuration / configuration overhaul

    Any arguments given as part of the command line arguments should override any settings given in the config files.

    Due to the nature of how many arguments will be available. I will not be accepting any pull requests that do not have detailed documentation included.

    opened by ConradSelig 9
  • Buying / Selling stocks at multiple prices

    Buying / Selling stocks at multiple prices

    Currently tracking a stock allows for a single "total owned" value and a single "bought at" value, meaning if multiple shares of the same stock are purchased at different prices - the user has to manually take an average of the purchase prices to get decent portfolio data.

    I'm not yet best sure how to best implement this. The multiple config files are already messy enough as is, and adding a line or two for every purchase would become unmanageable quite quickly.

    Adding the "help wanted" label to this ticket as I am currently taking suggestions for implementation of this feature.

    help wanted 
    opened by ConradSelig 7
  • Performance Improvements and Gains tracking

    Performance Improvements and Gains tracking

    • building off of #30
    • refactor portfolio and stock classes for more efficient processing
    • refactor renderer
    • add gains/loss tracking to table output
    • argument parsing refactor
    opened by patrick-hovsepian 6
  • Performance improvements

    Performance improvements

    @ConradSelig This builds off of my previous PR and I am just seeing your comments there.

    This PR is mainly for performance improvements - the biggest change is fetching all ticker data in one request rather than a request per ticker.

    If you're not opposed, I'll work the feedback from the previous PR into this one and just close that.

    I'm aware of the merge conflicts and will address those - in the meantime, wanted to get your eyes on this.

    opened by patrick-hovsepian 3
  • Added manual color selection

    Added manual color selection

    Feature includes: Manual color selection to the portfolio.ini file (added instructions in the readme). This is either from the approved list, or using Hex code (which gives the used complete freedom with the color, as you mentioned). Color selection when actually drawing the graph (one of the three cases for no manual color, worded manual color, and hex manual color). Input test in the Portfolio.populate function, where I check that the color entered is valid.

    opened by yonMaor 3
  •  RuntimeWarning: invalid value encountered in double_scalars

    RuntimeWarning: invalid value encountered in double_scalars

    PORTFOLIIO.IN

    Aya-Anu:~/code/oss/cliStocksTracker$ cat portfolio.ini ;[AAPL] ;graph=True ;buy=10@100 ;buy=5@120 ;sell=3@122 ;sell=8@125 ;color=#FFFF00

    ; Ford Motor Company [F] graph=True color=#FFFF00

    CONFIG.INI

    Aya-Anu:~/code/oss/cliStocksTracker$ cat config.ini [Frame] width=80 height=20

    [General] independent_graphs=False timezone=America/Phoenix rounding_mode=math

    OUTPUT

    Aya-Anu:~/code/oss/cliStocksTracker$ python3 cliStocksTracker.py

    1 Failed download:

    • FOO: No data found for this date range, symbol may be delisted /Users/clu/code/oss/cliStocksTracker/portfolio.py:44: RuntimeWarning: invalid value encountered in double_scalars self.gains_per_share = self.gains / self.count

    <...Graph Deleted for Brevity...>

    Current Time: Friday Mar 19, 2021 - 12:22:30 PM Total Cost: $0
    Total Value: $0
    /Users/clu/code/oss/cliStocksTracker/renderer.py:135: RuntimeWarning: invalid value encountered in double_scalars gain / self.portfolio.cost_value * 100, self.mode, 2 Value Gained Today: +$0 +0%
    Value Gained Overall: +$0 +0%

    opened by sconnet 2
  • Load Stocks Independently from Market Sync

    Load Stocks Independently from Market Sync

    • load the portfolio file independently of syncing market data
    • create ui directory/package and move renderer there
    • rename project file to main.py
    • remove the need for config.ini (will be more apparent why in next PR) -- all args get assigned a default and can be controlled directly through the CLI
    • add initial buy/sell transaction support
    opened by patrick-hovsepian 2
  • Table Column Configuration

    Table Column Configuration

    • introduce a way to programmatically print table data. Each column get's a formatter and as we iterate the portfolio entries we use just call the formatter for the given column.
    • individual cell color
    • row highlighting
    opened by patrick-hovsepian 2
  • Table view of Portfolio

    Table view of Portfolio

    Currently the portfolio summary is rather... primitive. While I still want to maintain the original spirit of the project and keep the portfolio summary an "at a glance" table, I would love to increase the amount of information shown akin to mop.

    High Priority 
    opened by ConradSelig 2
  • new

    new

    My name is Luis, I'm a big-data machine-learning developer, I'm a fan of your work, and I usually check your updates.

    I was afraid that my savings would be eaten by inflation. I have created a powerful tool that based on past technical patterns (volatility, moving averages, statistics, trends, candlesticks, support and resistance, stock index indicators). All the ones you know (RSI, MACD, STOCH, Bolinger Bands, SMA, DEMARK, Japanese candlesticks, ichimoku, fibonacci, williansR, balance of power, murrey math, etc) and more than 200 others.

    The tool creates prediction models of correct trading points (buy signal and sell signal, every stock is good traded in time and direction). For this I have used big data tools like pandas python, stock market libraries like: tablib, TAcharts ,pandas_ta... For data collection and calculation. And powerful machine-learning libraries such as: Sklearn.RandomForest , Sklearn.GradientBoosting, XGBoost, Google TensorFlow and Google TensorFlow LSTM.

    With the models trained with the selection of the best technical indicators, the tool is able to predict trading points (where to buy, where to sell) and send real-time alerts to Telegram or Mail. The points are calculated based on the learning of the correct trading points of the last 2 years (including the change to bear market after the rate hike).

    I think it could be useful to you, to improve, I would like to share it with you, and if you are interested in improving and collaborating I am also willing, and if not file it in the box.

    If tou want, Please read the readme , and in case of any problem you can contact me , If you are convinced try to install it with the documentation. https://github.com/Leci37/stocks-Machine-learning-RealTime-telegram/tree/develop I appreciate the feedback

    opened by Leci37 0
  • Take tickers from the command line?

    Take tickers from the command line?

    Would be great if we could check a graph (and other info) for a ticker provided not via portfolio.ini but simply from command line, something like this:

    cliStocksTracker.py --stock=AAPL
    

    By that, it would be possible to use cliStocksTracker.py as a quick reference. What do you think? Or am I missing something, and this is already possible?

    opened by 097115 1
  • Table values should be buffered to n decimal places.

    Table values should be buffered to n decimal places.

    This is a string formatting problem more than a techincal one. All values in the table should be buffered out to include n decimal places.

    If n=2 "14.0" -> "14.00" "235.6" -> "235.60" "5" -> "5.00"

    There are some places in the table that use more than two decimal places, so decimals should be buffered out to match the rounding wherever needed.

    good first issue 
    opened by ConradSelig 0
  • Testing Suite

    Testing Suite

    I've set up the pipline for proper testing - but there are still no tests to run! This ticket will serve as a place for everyone who wants to write some test cases to collaborate.

    New testing files should go in ./tests/

    The testing framework we are using is pytest, find their documentation here.

    The testing suite will now be run everytime a commit is pushed into the repo, tests will not automatically run for pull requests (until they are pulled). Code coverage is also automatically uploaded everytime a commit is pushed, you can find exact details for coverage here at codecov.

    I'm going to be flushing out the testing suite to the best of my ability for the next week or so - but any help would be appreciated!

    opened by ConradSelig 0
  • Stash data after market close

    Stash data after market close

    Currently even after market close cliStocksTracker will re-download the data for each ticker, despite the fact it hasn't changed. A tmp file should be created at market close to store the last (market) day's data so we don't have to redownload that everytime.

    opened by ConradSelig 2
Owner
Conrad Selig
Conrad Selig
Gamestonk Terminal is an awesome stock and crypto market terminal

Gamestonk Terminal is an awesome stock and crypto market terminal. A FOSS alternative to Bloomberg Terminal.

Gamestonk Terminal 18.6k Jan 3, 2023
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Stream your favorite shows straight from the command line.

A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Jonardon Hazarika 17 Dec 11, 2022
Library and command-line utility for rendering projects templates.

A library for rendering project templates. Works with local paths and git URLs. Your project can include any file and Copier can dynamically replace v

null 808 Jan 4, 2023
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Dec 30, 2022
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
📦 A command line utility to put text in a box.

boxie A command line utility to put text in a box. Installation pip install boxie If you are on Linux you may need to use sudo to access this globally

Eliaz Bobadilla 10 Jun 30, 2022
A handy command-line utility for generating and sending iCalendar events

A handy command-line utility for generating and sending iCalendar events This simple command-line utility is designed to generate an iCalendar event,

Baochun Li 17 Nov 21, 2022
Tiny command-line utility for mapping broken keys to other positions.

brokenkey Tiny command-line utility for mapping broken keys to other positions. Installation Clone this repository using git: git clone https://github

null 0 Oct 4, 2021
This is a CLI utility that allows you to view RedFlagDeals.com on the command line.

RFD Description Motivation Installation Usage View Hot Deals View and Sort Hot Deals Search Advanced View Posts Shell Completion bash zsh Description

Dave G 8 Nov 29, 2022
img-proof (IPA) provides a command line utility to test images in the Public Cloud

overview img-proof (IPA) provides a command line utility to test images in the Public Cloud (AWS, Azure, GCE, etc.). With img-proof you can now test c

null 13 Jan 7, 2022
cmsis-pack-manager is a python module, Rust crate and command line utility for managing current device information that is stored in many CMSIS PACKs

cmsis-pack-manager cmsis-pack-manager is a python module, Rust crate and command line utility for managing current device information that is stored i

pyocd 20 Dec 21, 2022
Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems.

Baselining, on steroids! Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems. The proje

Nelson 4 Dec 9, 2022
A Python module and command line utility for working with web archive data using the WACZ format specification

py-wacz The py-wacz repository contains a Python module and command line utility for working with web archive data using the WACZ format specification

Webrecorder 14 Oct 24, 2022
A command-line utility that, given a markdown file, checks whether all its links work.

A command-line utility written in Python that checks validity of links in a markdown file.

Teclado 2 Dec 8, 2021
A Python module and command-line utility for converting .ANS format ANSI art to HTML

ansipants A Python module and command-line utility for converting .ANS format ANSI art to HTML. Installation pip install ansipants Command-line usage

null 4 Oct 16, 2022
Booky - A command line utility for bookmarking files on your terminal!

Booky A command line utility for bookmarking files for quick access With it you can: Bookmark and delete your (aliases of) files at demand Launch them

Pran 1 Sep 11, 2022
split-manga-pages: a command line utility written in Python that converts your double-page layout manga to single-page layout.

split-manga-pages split-manga-pages is a command line utility written in Python that converts your double-page layout manga (or any images in double p

Christoffer Aakre 3 May 24, 2022
A Python command-line utility for validating that the outputs of a given Declarative Form Azure Portal UI JSON template map to the input parameters of a given ARM Deployment Template JSON template

A Python command-line utility for validating that the outputs of a given Declarative Form Azure Portal UI JSON template map to the input parameters of a given ARM Deployment Template JSON template

Glenn Musa 1 Feb 3, 2022
slipit is a command line utility for creating archives with path traversal elements.

slipit is a command line utility for creating archives with path traversal elements. It is basically a successor of the famous evilarc utility with an extended feature set and improved base functionality.

usd AG 35 Dec 23, 2022