The Stock App That Could

leo
3 min readMay 22, 2021

--

PyStocks, as I hereby name it, has been fun to create.

Matter of fact, it is still incomplete. I need to implement python-daemon.

But here is what isn’t.

PyStocks has two main modes of usage.

  1. A Curses CLI
  2. A (to-be) daemonized, argument-based CLI

Said modes are executed through given arguments.

[ui] - stocks.py -u

[args] - stocks.py -t <ticker> -e <email>

The UI system is composed of the following functionalities:

UI interface

1) Stock/ticker Selection

2) Data gathering, parsing and viewing:

a) general data of said stock

b) the earnings histories of said stock

one of the five earnings entries

c) financial statements of said stock

Stock data is scraped from Yahoo Finance.

The Argument/Daemon system is composed of the following functionalities:

1) It parses the given ticker and email provided in the arguments

2) The following sets of stock data are obtained: current price, PE/G ratio, trailing price/earnings, price/sales ratio. These are stored in memory and in a plaintext file.

3) It reads and parses a given SMTP server entry in the configuration file

4) An SSL connection is initiated with the SMTP server

5) Every 30 minutes, the current price of the stock is rechecked. If the price has decreased 5% or more, it sends an email notification to the provided email (given in arguments) containing a refreshed set of the information gathered in step 2, and the amount of percent decrease. All old data is overwritten by the new in the plaintext storage.

(i cropped my email address out the screenshot)
I used the gmail SMTP servers to send my email; just with my normal google account. Ignore the percentage mark placement.

Never miss the dip again.

--

--

leo
leo

Written by leo

0 Followers

heyyyyyyyy

No responses yet