DEV Community

Tomasz Giba
Tomasz Giba

Posted on

How to get live currency rate(s) in command line

You need curl and jq packages:

sudo apt install curl jq
Enter fullscreen mode Exit fullscreen mode

You can do this using floatrates.com API. It's updated daily at midnight.

For USDPLN:

curl http://www.floatrates.com/daily/usd.json | jq .pln
Enter fullscreen mode Exit fullscreen mode

..or for USDEUR:

curl http://www.floatrates.com/daily/usd.json | jq .eur
Enter fullscreen mode Exit fullscreen mode

...and for EURUSD:

curl http://www.floatrates.com/daily/eur.json | jq .usd
Enter fullscreen mode Exit fullscreen mode

and so on.

Oldest comments (2)

Collapse
 
paraspl01t profile image
Tushar Tyagi

Very nice and simple explaination. Do you know if there any request limit on this API?

Collapse
 
tomaszgiba profile image
Tomasz Giba

I would expect there is a limit, but I don't know what it is.