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
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
Connect Your Led Strip With Your Arduino Board
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
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.