forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbtcmarkets.10s.sh
executable file
·24 lines (21 loc) · 949 Bytes
/
btcmarkets.10s.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
#
# <xbar.title>BTC Markets ETH & BTC Ticker</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Fred Wu</xbar.author>
# <xbar.author.github>fredwu</xbar.author.github>
# <xbar.desc>Displays the latest Etherium and Bitcoin prices in AUD and their 24h trade volumes from BTC Markets.</xbar.desc>
# <xbar.image>http://i.imgur.com/7UwilDM.png</xbar.image>
echo -n "ETH "; curl -s https://api.btcmarkets.net/market/ETH/AUD/tick | \
grep -Eo 'lastPrice":[0-9\.]+' | sed 's/lastPrice"://' | tr -d '\n'; \
echo -n " BTC "; curl -s https://api.btcmarkets.net/market/BTC/AUD/tick | \
grep -Eo 'lastPrice":[0-9\.]+' | sed 's/lastPrice"://'
echo '---'
echo 'Volume 24h'
for COIN_TYPE in 'ETH' 'BTC'
do
echo -n "$COIN_TYPE "; \
curl -s "https://api.btcmarkets.net/market/$COIN_TYPE/AUD/tick" | \
grep -Eo 'volume24h":[0-9\.]+' | sed 's/volume24h"://' | tr -d '\n'; \
echo '| href=https://www.btcmarkets.net/'
done