getPriceAdaUsd.sh 349 B

123456789101112
  1. #!/usr/bin/env bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. DATE_START=$(date +%FT%H:%M)
  7. DATE_END=$(date +%FT%H:%M --date="next minute")
  8. ADA_PRICE=$(curl -s "https://production.api.coindesk.com/v2/price/values/ADA?start_date=${DATE_START}&end_date=${DATE_END}&ohlc=false" | jq '.data.entries[][1]')
  9. printf "%0.2f\n" "${ADA_PRICE}"