summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorXiao Pan <xyz@flylightning.xyz>2024-08-08 17:00:22 -0700
committerXiao Pan <xyz@flylightning.xyz>2024-08-08 17:00:22 -0700
commit903c04bd8b831acaf9a3dc863f9bbb8fc601a0d1 (patch)
tree964eb26abdb13030b98f73e810f8738c582064e9 /sh
parentc66744e68ba5c6bc33c342f96343ea99288dc9fe (diff)
coinbase xmr return null, so I switch to kraken api
Diffstat (limited to 'sh')
-rwxr-xr-xsh/rate14
1 files changed, 5 insertions, 9 deletions
diff --git a/sh/rate b/sh/rate
index 1625df6..3b4d404 100755
--- a/sh/rate
+++ b/sh/rate
@@ -1,11 +1,7 @@
#!/bin/sh
-while getopts f:t: opt; do
- case $opt in
- f) from="$OPTARG";;
- t) to="$(echo "$OPTARG" | tr '[:lower:]' '[:upper:]')";;
- \?) exit 1;;
- esac
-done
-# https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates
-curl -s "https://api.coinbase.com/v2/exchange-rates?currency=${from:-xmr}" | jq -r ".data.rates.${to:-USD}"
+# https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTickerInformation
+# click url/ result to see more return data descriptions
+# last 24 hours volume weighted average price
+# XXMRZUSD seems same as XMR/USD, but don't know how to query XMR/USD via jq
+curl -s "https://api.kraken.com/0/public/Ticker?pair=XXMRZUSD" | jq -r .result.XXMRZUSD.p.[1]