Stock Watch List, a python terminal app

Chandler Barlow
3 min readJun 24, 2020

Recently I’ve gotten pretty into investing.

Investing is a great way to slowly make some money off of money you have laying around. My savings account has a terrible interest rate ( something like .01% a year ) which means if I’m lucky I could make cent after just a few years of saving.

What’s the point of sitting on my money waiting to make literal cents? There had to be better options.

After a couple of weeks of research I settled on investing in some safe ETFs.

An ETF is a type of share you can purchase that is part of an Index fund. What’s cool about ETFs is that they’re traded on the market like a regular share but not tied to the price of any one particular company.

After setting up my online broker account I started purchasing shares.

After purchasing a few shares I realized that I would have to actually start paying attention to the market and babysitting my money. That meant no more automatically deleting the stocks app off of my phone or turning off the radio when they started reading market reports ( yay me ).

Again after a few days of participating in adult society I felt there had to be a better way.

I set out to make my own simple terminal app for getting the status of my positions. I wanted the app I made to be lightweight and pretty minimal so that I could quickly check on my money without opening a browser, because let’s be real here, browsers are a great way to get distracted. Too often I set out to check something simple on google then end up sending a bunch of automated happy birthday messages to recruiters on LinkedIn ( how are you doing Tony! ).

When making a little app like this there are a few things to decide.

  • What API am I going to use?
  • Where is this data coming from?
  • What language will I use?

Here’s what I decided on. Yfinance, YahooFinance and Python3.

First I setup the python3 virtual env to manage my dependencies. If this is something you aren’t familiar with I’d advise you to at least check into it. Python3’s virtual environments make managing your modules pretty easy and future proof.

Second I checked out YahooFinance’s API. It’s complicated. I decided not to write my own wrapper for the API calls because a good rule of thumb when writing stuff with Python is that if you need something look for it before you write it. In the future I want to build my own library for interacting with my online broker ( watch out for that I’m currently writing it ) but for now something someone else wrote should work fine.

Third, yFinance. I found it out there on the internet. Some sweet soul wrote a pretty sick module for interacting with the Yahoo Finance API. Using this little library was pretty pleasant so I’d recommend it to anyone trying to do anything similar. It’s a little slow but for a temporary solution it would work great.

After all my searching I found my tools and built my app.

I included it in my path so I could quickly check my share out.

Goal completed!

~Some notable stuff~

The config.json lets you update the companies you want to watch. You can also set the refresh rate in minutes for the app to poll market data.

If you want to clone it, steal my code, or check on your stocks at work feel free to check it out here.

--

--

Chandler Barlow

Fullstack Developer at Irys / JavaScript Junkie / Creative Coder