-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbtc2usd
More file actions
44 lines (36 loc) · 1.63 KB
/
Copy pathbtc2usd
File metadata and controls
44 lines (36 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/bash
# 2020-10-19 19:29:08
# 2025-01-16 20:45:26 reordered, a hint for the XFCE command output applet
# 2025-04-28 14:32:28 coindesk can go fuck themselves
# 2026-08-25 17:54:43 coindesk must fuck itself
# 2026-09-20 17:31:29 coindesk please fuck yourself
if ! jq --version &>/dev/null; then
echo "Install jq"
exit 1
fi
tooltip()
{
echo -n "1st: coingecko.com; 2nd: binance" #coindesk.com via Google Finance BETA;"
}
rawdata()
{
#`curl --silent --max-time 7 'https://data-api.cryptocompare.com/asset/v1/top/list?page=1&page_size=15&sort_by=CIRCULATING_MKT_CAP_USD&sort_direction=DESC&groups=ID%2CBASIC%2CSUPPLY%2CPRICE%2CMKT_CAP%2CVOLUME%2CCHANGE%2CTOPLIST_RANK&toplist_quote_asset=USD&response_format=JSON' | jq '.Data.LIST[] | select(.SYMBOL == "BTC") | .PRICE_USD'`
#`wget -O - -q --timeout=7 'https://www.google.com/finance/beta/quote/CDIXBX:INDEXNYSEGIS' | sed -n 's/.*"INDEXNYSEGIS"],"CoinDesk Bitcoin Price Index",1,null,\[\([^,]*\).*/\1/p' | cut -d. -f1`
price1=`curl --silent --max-time 7 'https://api.coingecko.com/api/v3/coins/bitcoin?developer_data=false&community_data=false&tickers=false' | jq '.market_data.current_price.usd'`
price2=`curl -s "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT" | jq -r '.price | tonumber | floor'`
printf "%'.f %'.f" "$price1" "$price2" 2>/dev/null
}
if [ "$XDG_CURRENT_DESKTOP" = "wayfire" ]; then
case "$1" in
tooltip)
tooltip
;;
*)
rawdata
;;
esac
else
echo "<txt> "`rawdata`" </txt>"
echo "<tool>"`tooltip`"</tool>"
echo "<txtclick>firefox https://coingecko.com</txtclick>"
fi