Live currency exchange rates

This snippet gives live exchange rates. In order to use it, you need to get a personal API token from https://exchangerate.host/ which will replace the XXXX. The free option gives you 100 queries per month. You can change the currency by changing the current GBPUSD option.

{note}{urlload: https://api.exchangerate.host/live?source=GBP&currencies=USD&access_key=XXXX; done=(res) -> ["response": fromjson(res), "isloading": no]; start=() -> ["isloading": yes]} {if: isloading}Loading...{else}Response: {=response}{endif}
{rate=response["quotes"]["GBPUSD"]; trim=yes}{endnote}
US Exchange Rate = {=rate} at {time: HH:mm} on {time: Do MMM YY}

4 Likes

Variation of the above to select from a number of currency pairs. These could be changed to reflect your own requirements.

{formmenu: default=GBPUSD; GBPCAD; GBPEUR; GBPAUD; GBPNZD; name=currency_pair}
{note: trim=no}{urlload: https://api.exchangerate.host/live?source=GBP&currencies={=right(currency_pair,3)}&access_key=XXXX; done=(res) -> ["response": fromjson(res), "isloading": no]; start=() -> ["isloading": yes]} {if: isloading}Loading...{else}Response: {=response}{endif}{rate=response["quotes"][currency_pair]; trim=yes}{endnote}
{if: currency_pair="GBPUSD"}USA{elseif: currency_pair="GBPCAD"}Canada{elseif: currency_pair="GBPEUR"}Euro{elseif: currency_pair="GBPAUD"}Australia{elseif: currency_pair="GBPNZD"}New Zealand{endif} Exchange Rate = {=rate} at {time: HH:mm} on {time: Do MMM YY}
£{formtext: name=amount; cols=7} = ${=amount* rate; format=.2f}

Hi Tony,

Thanks for sharing!

For sharing snippets, you can wrap the content you can click the + icon shown below, and select snippet, to help it display as a snippet in the post

It would then be displayed as below:

This is a snippet

Best regards,
Alexander

Hi. I did use the +, selected Snippet and got placemarkers to, I assume, paste the snippet

Yes, that is correct. You paste the snippet between those markers and it will display as I showed above.