Untitled Bash Script

#!/bin/bash
#
# Exchange Rates -> MQTT
#
#   $ mosquitto_sub -h broker.hivemq.com -p 1883 -t 'easypi/xe/#' -F '%t -> %p'
#

curl -s -u lodestar:v7a8WTdvw14fWhQPBLLGbjnUa3DXcyFc https://www.xe.com/api/protected/midmarket-converter/ |
  jq -c '.timestamp as $t | .rates | to_entries[] | {timestamp:$t, currency:.key, rate:.value}' |
    while IFS= read -r payload
    do
      read t k v <<< $(jq -r "[.timestamp, .currency,.rate]|@tsv" <<< $payload)
      echo "$(date -d @${t:0:10} +%FT%T) $k -> $v"
      mosquitto_pub -h broker.hivemq.com -p 1883 -t "easypi/xe/$k" -m "$payload" -r
    done
$ ./exchange-rates.sh
2022-01-14T03:09:00 AED -> 3.6725
2022-01-14T03:09:00 AFN -> 104.6431533042
2022-01-14T03:09:00 ALL -> 106.6149550195
2022-01-14T03:09:00 AMD -> 479.4028451822
2022-01-14T03:09:00 ANG -> 1.7896338894
2022-01-14T03:09:00 AOA -> 545.9274026334

$ mosquitto_sub -h broker.hivemq.com -p 1883 -t 'easypi/xe/#' -F '%t -> %p'
easypi/xe/AED -> {"timestamp":1642129740000,"currency":"AED","rate":3.6725}
easypi/xe/AFN -> {"timestamp":1642129740000,"currency":"AFN","rate":104.6431533042}
easypi/xe/ALL -> {"timestamp":1642129740000,"currency":"ALL","rate":106.6149550195}
easypi/xe/AMD -> {"timestamp":1642129740000,"currency":"AMD","rate":479.4028451822}
easypi/xe/ANG -> {"timestamp":1642129740000,"currency":"ANG","rate":1.7896338894}
easypi/xe/AOA -> {"timestamp":1642129740000,"currency":"AOA","rate":545.9274026334}