Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bash script to scrape current bitcoin exchange prices and update a local json file
#!/bin/bash
BTC_PATH=$1
REMOTE_URL=http://bitcoincharts.com/t/weighted_prices.json
wget -q -O $BTC_PATH.temp $REMOTE_URL
test $? -ne 0 && exit
test ! -e $BTC_PATH.temp && exit
test $(stat -c%s $BTC_PATH.temp) -lt 600 && exit
mv $BTC_PATH{.temp,}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment