Last active
August 15, 2017 10:44
-
-
Save shrwnsan/540ba32d0952b0f517a25f6271b863c3 to your computer and use it in GitHub Desktop.
Coins.ph BTC rate tracker. This was actually from a gifted colleague of mine. Did some UX improvements =)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
AS_OF_DATE=$(date "+%Y-%m-%d %H:%M") | |
RESULT=$(curl -s https://quote.coins.ph/v1/markets/BTC-PHP | /usr/local/bin/jq -r '.market.bid,.market.ask') | |
BID=$(echo $RESULT | sed 's/ /-/g' | cut -f1 -d-) | |
ASK=$(echo $RESULT | sed 's/ /-/g' | cut -f2 -d-) | |
USD=$(echo "scale=2; $ASK/50" | bc) | |
echo "$AS_OF_DATE => $BID - $ASK (\$$USD)" | |
if [ $ASK -lt 200000 ] | |
then | |
osascript -e "display notification \"Bid: $BID\nAsk: $ASK\" with title \"As of $AS_OF_DATE\"" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* * * * * . ~/coins-btc-tracker.sh >> ~/coins-btc-tracker.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment