From 9326c9f10541e83da5e525c1e001e75f5cd1f56e Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 5 Mar 2017 15:17:45 +1300 Subject: Add currency spot price util --- local/bin/grab-spot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 local/bin/grab-spot (limited to 'local/bin/grab-spot') diff --git a/local/bin/grab-spot b/local/bin/grab-spot new file mode 100755 index 0000000..3939d72 --- /dev/null +++ b/local/bin/grab-spot @@ -0,0 +1,13 @@ + +if [ -z $1 ]; then + logger "$0: blank FROM currency" + exit +fi +if [ -z $2 ]; then + logger "$0: blank TO currency" + exit +fi + +rate=$(curl "http://rate-exchange-1.appspot.com/currency?from=$1&to=$2" | jshon -e rate) + +echo "$1$2: $rate" > ~/.cache/"$1$2" -- cgit v1.1