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.Step 1 Connect your led strip with your Arduino board
The circuit diagram is given below. But I strongly suggest you to use seeeduino and its base shield like me. Because you can just plug in the socket and forget about the complex wiring.
Check the port your arduino is using. You are going to need it in the python code.
The code is pasted below.Step 4 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. Before you run it, remember to set up your initial investment.Step 5 Enjoy your real-time investment monitor!