erovira / transa-script

Shell script to compute the Itaú/BROU mean USD/UYU exchange rate
6 stars 2 forks source link

Add BCU support to transa.sh #18

Closed sebastian-correa closed 4 months ago

sebastian-correa commented 4 months ago

Summary

This PR adds support for a new exchange provider: BCU (Banco Central del Uruguay). This provides the real, unaffected by rounding, interbank exchange rate.

Close #16.

Questions

  1. If we wanted to use jq, that part of code could be replaced by
        BUY=$(echo $response | jq '.cotizacionesoutlist.Cotizaciones | sort_by(.Fecha) | last | .TCC')
        SELL=$(echo $response | jq '.cotizacionesoutlist.Cotizaciones | sort_by(.Fecha) | last | .TCV')

    We'd have to add an error message for jq not installed, but it would also allow for easier error handling in case we don't find any rate in the past 7 days (BCU returns status code 0 in the RespuestaStatus field). What do you prefer?

sebastian-correa commented 4 months ago

Should I add BCU to all examples? I think trying to do so is a bit moot, as just an example with each provider should be enough to understand how to use it, but I leave the decision to you.