-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCoinbasePrices.sh
executable file
·33 lines (29 loc) · 4.93 KB
/
CoinbasePrices.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
25
26
27
28
29
30
31
32
33
#!/bin/bash
# <bitbar.title>Coinbase Prices</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.author>Mustafa Türksavaş, UdjinM6</bitbar.author>
# <bitbar.author.github>mustafaturksavas</bitbar.author.github>
# <bitbar.desc>Displays Coinbase buy prices of Bitcoin, Ethereum, Litecoin, Dash.</bitbar.desc>
# <bitbar.image>https://media.giphy.com/media/3oEhmKvAlkJHoqalFK/giphy.gif</bitbar.image>
# <bitbar.dependencies>bash, python</bitbar.dependencies>
#
# Based on Cryptocurrency Prices plugin by viiraj (github.com/viiraj).
#
# I hope this plugin provides value for you and if you feel like it, tips are always appreciated.
# Bitcoin: 1MYkRDn8KtGeeQSoiafymPPB3mncVi2rKN
# Ethereum: 0x2F0138E7035d0dB3D5e0B5b3008D8E0746641E09
# Litecoin: LVYrJcvdBmhazNoAtJhBvaSsyY2kWHwraJ
bitcoin_icon='iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAQAAABLCVATAAAACXBIWXMAABYlAAAWJQFJUiTwAAABY0lEQVRIx2P4z0AdyEBzg1DAdIYfQJgCZHmCWdsYMAFRBs0BC2UAWT5g1p6hbZAggwIcrgALVQNZSWDWAQY24g3qwRtJ/xgeMqxkCGJgotQgGLzAoEUdg/4zvGQQIxzYLAyODF/gQv0MlgwWDK4MOQxbgV5DKG0nLtZ2wIUykII2EMmoU8QZtAWrQQwMB+HiDygzaDNc/CQlBskwfIKLN5JrkAxDFsMTuOh9BiFSDXoHDI2HDB9RlJ1kECc2r20hkI5OMXhQxyAQzCTNoDJgaAgAvaLLEMkwn+EbkuLvDBLkR78yUoD/Z0gn3yAGhnwk5V2UGBRGLYNmICkvIGzQLqwG8TA0oJQAVvg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F5mSUxKwmLDqCsi+y3Y2wG0B/ECd9XS7jIIbMbODl77JWxqINMVsWE79uB3i98CliKDGFZLT8Yi8B1J5qCZLKMbIauXY9if6fOK/RYGK6vSW7W0msF8EbebJLavsuqNXkuv42rOSh1DXWvANfcxV0ABfWsRwCymCmpmvvoXVGcwip4Sh8/jsCR8aMG2eVe9hB/VzPkRPGoju0lMR7Rxf45+AVONK7jcJrxvJGGmhU0PtuboFyXhWyOAC204r+NhhN2JAv3blUqspf34mrFZzPSs4xNGJWEiYs/ZAv3jRit8xkBWlTGyhAVJ+BnBAf04WrA6uhLAymicXqUWHCvQP5eEeuwwapcBb2CoYPVK2QdJGccHcQenCizG8ap5ALV0Q3ZAb4TLZWzEcZzOpmEzVrwpCXOtEOjDvTaeYa3kmiSMx7wJd2Bbh50PS8KDf5VFRdhbciY0kxTn8pw3Q2CgA46f4QnGJKGwzYsC2IX3JdhxJqvs1/iY7a1Lwuz6p9e6tJI/DAh9aD+iV7oAAAAASUVORK5CYII='
bit_price=$(curl -s -H "CB-Version: 2015-04-08" "https://api.coinbase.com/v2/prices/BTC-USD/buy" | python -c "import sys, json; print(json.load(sys.stdin)['data']['amount'])")
eth_price=$(curl -s -H "CB-Version: 2015-04-08" "https://api.coinbase.com/v2/prices/ETH-USD/buy" | python -c "import sys, json; print(json.load(sys.stdin)['data']['amount'])")
ltc_price=$(curl -s -H "CB-Version: 2015-04-08" "https://api.coinbase.com/v2/prices/LTC-USD/buy" | python -c "import sys, json; print(json.load(sys.stdin)['data']['amount'])")
dash_price=$(curl -s -H "CB-Version: 2015-04-08" "https://api.coinbase.com/v2/prices/DASH-USD/buy" | python -c "import sys, json; print(json.load(sys.stdin)['data']['amount'])")
link_price=$(curl -s -H "CB-Version: 2015-04-08" "https://api.coinbase.com/v2/prices/LINK-USD/buy" | python -c "import sys, json; print(json.load(sys.stdin)['data']['amount'])")
echo "$bit_price | templateImage=$bitcoin_icon"
echo "$eth_price | templateImage=$eth_icon"
echo "$ltc_price | templateImage=$ltc_icon"
echo "$dash_price | templateImage=$dash_icon"
echo "$link_price"