Building a Crypto Price Ticker

Maximus Powers
3 min readJan 3, 2023

--

It’s no secret the cryptocurrency market is in disarray. The bear market seems to grow deeper everyday with no end in sight. Crypto fanatics on podcasts, blogs, and social media will tell you the best way to make it through a bear market is to invest for the long term and not freak yourself out by checking the market everyday.

So, I decided to build an LED display so I can check… constantly. Mostly because I thought it’d look cool on my wall.

How it works

This article breaks down the general logic involved in a project like this. For a technical explanation of how my code accomplishes this, please see the readme.md file in this project’s GitHub repo.

Components

Step 1: Get Crypto Data

  1. Connect to the internet
  2. Initialize (input the symbols I want displayed)
  3. Call CoinMarketCap API for current market data

Step 2: Parse Data

A loop iterates through our list of symbols, doing the following for each one:

  1. Parse JSON data into variables: symbol, price, and 24 hour % change
  2. Store it in a dictionary of dictionaries (key: int pointer, value: symbol’s data)

Step 3: Display Data

  1. Build a string to display (concatenate the variables we stored at the pointer’s current value)
  2. Set the display’s text to our string

Step 4: Loop (Always Running)

  1. Refresh data (once every 5 minutes)
  2. Post data on the display
  3. Wait 5 seconds
  4. Increase the pointer’s value by one (now points to the next symbol’s data)
  5. Post the next symbol's data on the display

Important Info

Modules — This project uses a lightweight version of Python called CircuitPython. It doesn’t have all the modules you might be familiar with, but Adafruit has an online library of modules for anything you might need to do. You just have to add them to the ‘lib’ directory on your device

Room for Improvement

Local Memory — The ESP8266 is limited by it’s memory. Python is less efficient than other languages (such as C++) so you may run into memory allocation errors as you add more complexity. I wanted this code to run locally (plug and play style). However I might modify the project to process the data externally and build my own Flask API to get the data to the board. If you’d want to contribute to this, I’d love to talk about it. Email me: maximuspowersdev@gmail.com.

More Complex Data — Now that I’ve got the concept working, there’s a lot more data we can use from the CoinMarketCap API. I might mess around with it to show more data. The only problem is there isn’t a lot of real estate on the display. That just means I’ll have to get creative with things such as changing the color of the text to show price performance.

Pretty it up — It’s still a little ugly right now, I think I’ll play around with some colors, maybe add crypto logos, and adjust the text positioning. Its also easy to make the text constantly scroll instead of cycling through the different symbols one at a time.

Conclusion

This was a fun project to get comfortable with live data architecture and microcontrollers. I was able to put a lot of what I’ve learned about data processing to use, and learn more along the way.

And if I do say so myself, it looks pretty cool on my wall.

— Max

--

--

Maximus Powers

Building my Web3 stack everyday. Software engineer, background in data science.