#!/bin/bash
# GMO COIN Tiker API Sample
# https://api.coin.z.com/docs/#ticker

endPoint='https://api.coin.z.com/public'
path='/v1/ticker'
symbol='BTC'

#curl -Ss ${endPoint}${path} --get --data "symbol=${symbol}" | jq
list=($(
curl -Ss ${endPoint}${path} --get --data "symbol=${symbol}" \
| jq '.data[]' \
| jq -r '.symbol, .ask, .bid, .high, .last, .low, .volume, .timestamp'))

echo ${list[0]}
echo '  ask      bid     high     last     low      volume'
echo -------- -------- -------- -------- -------- ----------
printf '%8d %8d %8d %8d %8d %f\n' \
${list[1]} ${list[2]} ${list[3]} ${list[4]} ${list[5]} ${list[6]}
#echo ${list[7]}