-
Notifications
You must be signed in to change notification settings - Fork 13
/
getVRSCprice.sh
executable file
·29 lines (25 loc) · 956 Bytes
/
getVRSCprice.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
#!/bin/bash
#Copyright Alex English May 2019
#This script comes with no warranty whatsoever. Use at your own risk.
#Tested on Ubuntu 18.04
#Run "./getVRSCprice.sh <CurrencyPair>" to get the current CoinGecko price in CurrencyPair
#run without an argument to get the price in USD by default
#or run "./getVRSCprice.sh list" to get the list of supported currencies
#I may come back to add other output formats
if [ "$#" -le "0" ]; then
VS="usd"
elif [ "$#" -gt "1" ]; then
echo "Usage: ./getVRSCprice.sh <CurrencyPair>"
echo "Or - get valid currencies using ./getVRSCprice.sh list"
exit 1
else
if [ "$1" == "list" ]; then
echo "Supported currencies: " 1>&2
curl -X GET "https://api.coingecko.com/api/v3/simple/supported_vs_currencies"
exit 0
else
VS=$1
fi
fi
curl -X GET "https://api.coingecko.com/api/v3/simple/price?ids=verus-coin&vs_currencies=$VS" -H "accept: application/json"
printf '\n'