DEV Community

loading...

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

tomaszgiba profile image Tomasz Giba ・1 min read

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.

Discussion (2)

pic
Editor guide
Collapse
paraspl01t profile image
ParaSpl01t

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

Collapse
tomaszgiba profile image
Tomasz Giba Author

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