Crypto traders, ever wished your trading charts could jump off the screen? With Govee smart lights and a bit of code magic, you can turn your room into a real-time crypto trading dashboard for Bitcoin or your favorite altcoin!
I recently got purchased some additional Govee lights to expand my setup, these are Desktop based back-lights that really make my RGB setup pop behind the monitors, they also came with the new LAN control which got me looking into some fun with them, I came up with the following silly project,
What You’ll Need
Givee smart lights controllable via Lux by JackDevey
A computer running Windows
A thirst for customizable trading signals
The Code
Let’s dissect the batch script that makes this all possible:
@echo off
echo "Activating Trading Mood"
REM lux devices - show all devices
lux turn 1 on
REM set colour blue
lux color 1 0000FF >nul
REM lux color 1 0eff00 - light green
REM lux color 1 063b00 - dark green
REM lux color 1 FF0000 - red
REM lux color 1 4C0000 - dark red
@echo off
setlocal enabledelayedexpansion
echo "Starting Price Monitor.."
REM API endpoint URL
set "url=https://api.binance.com/api/v3/avgPrice?symbol=BTCUSDT"
REM Initialize previous price
set "prev_price="
REM Create a temporary file to store the PowerShell command output
set "tempFile=%TEMP%\btc_price_temp.txt"
:loop
REM Make the API request using PowerShell and save the response to the temporary file
REM round down
powershell -command "& { $response = Invoke-RestMethod -Uri \"%url%\"; [math]::floor($response.price) }" > "%tempFile%"
REM Read the content of the temporary file into a variable
set /p btc_price=<"%tempFile%"
REM Display intermediate values
REM echo API Response: %btc_price%
REM Check if the price has changed
echo "Checking Price.."
if not "!btc_price!" == "!prev_price!" (
REM Notify about the price change
if defined prev_price (
if !btc_price! gtr !prev_price! (
echo ^ BTC Price went up from !prev_price! to !btc_price! - Yay!
lux color 1 0eff00 >nul
ping -n 4 127.0.0.1 >nul
lux color 1 063b00 >nul
ping -n 2 127.0.0.1 >nul
) else (
echo v BTC Price went down from !prev_price! to !btc_price! - Boo.
lux color 1 FF0000 >nul
ping -n 4 127.0.0.1 >nul
lux color 1 4C0000 >nul
ping -n 2 127.0.0.1 >nul
)
)
set "prev_price=!btc_price!"
)
REM Delay for 15 seconds
ping -n 16 127.0.0.1 >nul
REM Repeat the loop
goto loop
REM Delete the temporary file
del "%tempFile%" >nul
endlocal
Explanation
Trading Edge: This script pulls live Bitcoin price data (BTCUSDT) from the Binance API, signaling changes with visual cues.
Degen Delight: Easily modify the API endpoint to track any coin or token – perfect for those sweet altcoin pumps!
Batch Power: Batch scripts provide a simple way to automate tasks on Windows, giving you flexible control.
Step-by-Step Guide
Light it Up: Set up your Govee lights and learn how to control them using “lux” commands or their equivalent.
Code Wizardry: Save the code as a .bat file on your Windows system.
Initiate the Signal: Double-click the script and watch those lights become your crypto oracles!
Take it to the Next Level
Pump and Dump Colors: Customize the colors for major price swings, tailoring the signals to your strategy.
Sound the Alarm: Add audio alerts for those critical moments when your coin breaks out or crashes.
Full Degen Mode: Set up multiple scripts and lights to track your entire altcoin portfolio.
Conclusion
Get creative with this concept! It’s a fantastic way to add a unique, visual dimension to your trading environment. Whether you’re a Bitcoin bull or an altcoin adventurer, these smart light signals can help you stay one step ahead.