Stock Market Portfolio Tracker

Hugh Greethead
Hugh Greethead
Published in
3 min readApr 1, 2020

I made a terminal application to track stock prices with portfolio and watchlist functionality.

The Stock Market Portfolio Tracker is a terminal application designed to provide an easy way for users to get up-to-date, basic price information of all the major stocks trading in the US. Data is pulled from the IEX Cloud API.

Purpose

To have a tool that allows users to easily check basic information about a stock that is up to date from the terminal.

Motivation for the project

I am currently studying Web Development in a bootcamp at CoderAcademy. We were tasked with building an application that runs in the terminal, that is user friendly and makes use of external libraries.

Investing and markets is one of my passions that I learn about in my free time, so motivation behind the project was to create a simple tool that myself or someone similar to me, could find useful after the project was over — in terms of using stock market data (in current form or extended functionality of original project).

What it does

The Stock Market Portfolio Tracker provides a simple interface for looking up prices and other stock market data such as:

  • company name
  • sector
  • latest traded price
  • pe ratio
  • price change since yesterday
  • price change year to date
  • price change since 52 week high/low

Users can also set a watchlist and track their portfolio stocks and the total portfolio value, all in a simple to navigate terminal interface.

What I learnt doing this project

The Stock Market Portfolio Tracker was my first major project built in Ruby. I got a lot out of building in Ruby as it helps to realise the power of building in high-level O-O languages in terms of how quickly and easily you can build things compared to lower level languages I first learnt to program in like C.

This was also the first time I had gotten very hands on with working with an API — through the ‘stock_quote’ Gem, interacting with the IEX Cloud API. This was a great first project for working with APIs as its more simple in scope as I was only making GET requests to pull in data. One cool thing was that it became obvious to me how powerful and versatile using APIs can be, whether it be for providing the framework to expand this app in future or build other stock market based applications, the fundamental building block of using the API data will remain the same.

Possible improvements

I would like to refactor the application to take command line arguments rather than use the‘TTY-Prompt’ gem to have a pseudo GUI, because in reality the people more likely to use this app would already be familiar and comfortable using the command line, and having the prompt menus would add friction and unnecessary time spent to use the app.

Expanding the universe of stocks that it is compatible with — starting with the Australian market that a lot of my peers invest in would be a great starting point.

Add export to CSV would be a cool function for those wishing to track/do their own analysis in spreadsheets.

Project Github repository

Please feel free to fork, play around with it and let me know if you have any ideas for features that could make it better!

-Hugh

I am a junior developer in training at CoderAcademy in Sydney, Australia. My interests are in programming, economics, trading and Bitcoin. Follow me on Twitter @hughgreethead

--

--