Skip to content

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

License

Notifications You must be signed in to change notification settings

patrick-hovsepian/cliStocksTracker

 
 

Repository files navigation

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
  • webcolors==1.11.1

Manual

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

Usage

usage: cliStocksTracker.py [-h] [--width WIDTH] [--height HEIGHT]
                           [--independent-graphs] [--timezone TIMEZONE]
                           [-r ROUNDING_MODE] [-ti TIME_INTERVAL]
                           [-tp TIME_PERIOD] [--config CONFIG]
                           [--portfolio-config PORTFOLIO_CONFIG] [-g]

Options for cliStockTracker.py

optional arguments:
  -h, --help            show this help message and exit
  --width WIDTH         integer for the width of the chart (default is 80)
  --height HEIGHT       integer for the height of the chart (default is 20)
  --independent-graphs  show a chart for each stock
  --timezone TIMEZONE   your timezone (ex: America/New_York)
  -r ROUNDING_MODE, --rounding-mode ROUNDING_MODE
                        how should numbers be rounded (math | down)
  -ti TIME_INTERVAL, --time-interval TIME_INTERVAL
                        specify time interval for graphs (ex: 1m, 15m, 1h)
  -tp TIME_PERIOD, --time-period TIME_PERIOD
                        specify time period for graphs (ex: 15m, 1h, 1d)
  --config CONFIG       path to a config.ini file
  --portfolio-config PORTFOLIO_CONFIG
                        path to a portfolio.ini file with your list of stonks
  -g, --generate-config
                        generates example config files

Do note that any given command line argument will override settings from the config file.

Configuration

cliStocksTracker relies on two config files, "config.ini" and "portfolio.ini".

config.ini

[Frame]
width=[ graph width ]
height=[ graph height ]

[General]
independent_graphs=[ True | False ]
timezone=[ pytz timezone stamp (ex. "America/New_York", "Asia/Shanghai", etc) ]
rounding_mode=[math | down]

If independent_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).

A default config.ini is packaged with the project.

All keys in config.ini file are required.

portfolio.ini

[ stock symbol ]
graph=[ True | False ]
owned=[ float ]
bought_at=[ float ]
color=[str]

[ stock symbol ]
graph=[ True | False ]
owned=[ float ]
bought_at=[ float ]
color=[str]
...

Each stock symbol has four additional config settings:

  1. "graph": Determines 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.
  4. "color": The custom color to display the stock on the graphs. This is not a mandatory configuration setting, and if left empty automatic color selection will take place.

The color can be chosen from the following list of colors:

'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgrey', 'darkgreen', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'grey', 'green', 'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgrey', 'lightgreen', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'

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

"owned" and "bought_at" are required keys, all others optional."

Similar projects



About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%