Visualize Your Bitcoin Gain and Loss With Arduino & Python

by memoryleakyu in Circuits > Arduino

362 Views, 1 Favorites, 0 Comments

Visualize Your Bitcoin Gain and Loss With Arduino & Python

IMG_1309_4.gif

Basic idea

Personally I'm a crypto currency investor. But I also have a hevy load of work to attend to. So I am not able to keep tracking bitcoin price like 10 times a minute. However, I still want to know whether I'm earning or lossing money. Thus, I decided to build a real-time feedback system of my investment using python. And to visualize it, I chose a led strip and an arduino. If I earned money, the leds will turn green. If I lose, they will turn red.

How does it work

To get real-time bitcoin data, I used an api provided by OKex, which is a large crypto currency exchange. Then I used python to calculate my gain and loss based on the streaming data. I set my target gain and loss to 5% everyday, which means more lights are on, my investment is closer to my target gain or loss. If all leds are turned on or off, the strip will statr to blink. So I can make decision about whether to keep holding or sell my bitcoins.

Supplies

Seeeduino V4.2 Buy Here

Seeed Waterproof WS2813 RGB LED Strip Waterproof Buy Here

Seeed Base Shield V2

Connect Your Led Strip With Your Arduino Board

IMG_0058.JPG

Connect your seeeduino with its base shield. Then plug in the led strip on digital pin 6 (D6)

Connect Your Arduino Board to Your Computer

Screen Shot 2020-01-15 at 22.24.17.png

Check the port your arduino is using. You are going to need it in the python code.

Upload the Arduino Code

Downloads

Run the Python Code

Make sure python library pyserial is installed. If you don't know whether you have installed the library, run

pip install pyserial

in your computer's terminal.

Befor executing the python code, remember to set up your initial investment data.

Python Code

Downloads

Enjoy Your Real-time Bitcoin Investment Monitor!