Simple script that checks Binance price of BTC or altcoin, and alerts when target price is hit.
Requires jq and bc:
brew install bc
brew install jq
Coin must be entered as BTCUSDT, ETHUSDT or LTCBTC etc.
#!/bin/bash
echo "Enter coin:"
read coin1
echo "Enter price target:"
read target
coin=$(echo "$coin1" | tr '[:lower:]' '[:upper:]')
while [ 1 ]
do
pricevar=`curl -s https://www.binance.com/api/v1/ticker/24hr?symbol=$coin | jq -r '.askPrice'`
echo "$coin" price is $pricevar
echo "-------------------------------------------"
if (( $(echo "$pricevar < $target" |bc -l) )); then
echo $coin lower than alarm zone $target
else
osascript -e 'display notification "'$coin' price alert '$pricevar' "'
fi
sleep 80
done