getPriceBtcArs.sh 587 B

12345678910111213
  1. #!/usr/bin/env bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. BTC_PRICE=$(curl -s "http://api.coindesk.com/v1/bpi/currentprice.json" | jq '.bpi.USD.rate' | tr -d '"' | sed 's:\.[^|]*::g' | sed 's/,//g')
  7. #USD_PRICE=$(curl -s "https://mercados.ambito.com//dolar/dolarturista/variacion" | jq '.venta' | tr -d '"' | sed 's:\,[^|]*::g')
  8. USD_PRICE=$(curl -s "https://mercados.ambito.com//dolarturista/variacion" | jq '.venta' | tr -d '"' | sed 's:\,[^|]*::g')
  9. BTS_PRICE_ARS=$(echo "${BTC_PRICE}*${USD_PRICE}" | bc)
  10. #printf "%'d\n" ${RESULT}
  11. printf "%0.0f\n" "${BTS_PRICE_ARS}"