Stock Ticker for the Terminal on a Raspberry Pi

I have an interest in investing and even though I’m a long term investor, I like to keep an eye on my portfolio to have a general idea of how it’s trending. I’ve also been wanting to check out Go to try something new. I wanted to write a script that my Pi could use to display some terminal output of my portfolio every few seconds.


I had already compiled Go on my Pi because I knew at one point I would attempt a project with it, and this seemed like something easy enough to start with. I compiled Go without using a swap or the test suite and it seems to have turned out fine.

Once I had Go installed, I created a directory structure from my user directory


Go looks for stuff using $GOROOT and $GOPATH variables, so I added those to my .bash_profile

export GOPATH=$HOME/projects/go
export GOROOT=$HOME/go

You’ll need to point your $GOROOT to where ever you installed it and you can point your GOPATH to your working directory. From the root dirs, Go looks in a /src/ subdir for packages so that’s why I set up my directories that way.

I created my gostock.go file and a stocks.txt file to maintain which stocks I wanted to pull in data for. You can clone the repository to try it out. Then just run:

go install gostock

If you put the project in your $GOPATH, it should create an executable in $GOPATH/bin. Once it’s installed, and you have a stocks.txt file in your user directory, you can just run


from the terminal and it should start pulling in data from Yahoo for the symbols in your stocks.txt.

You can set your own interval if you don’t want to refresh as often

gostock -i 20s

This would refresh the data every 20 seconds. The default is currently every 3 seconds. Data is pulled in from Yahoo’s YQL. They put a cap on public requests per IP at 2,000 per hour and their data is delayed 15 minutes.

If everything works, you’ll see output similar to

Gostock sample output