Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggreagtion Enquires Welcome

Include Currency Exchange Rates on Your Website (and the Exchange API)

The Currency exchange rate API is one of about a hundred finance-related API's we make available to clients via Yabber Tag: yabber. Government sourced, updated daily, and dating back to 1983, the RESTful Exchange API returns the exchange rate for a number of currencies compared against the Australian dollar. Useful as a standalone tool - or combined with other data sources - you're able to paint a picture of the economy in any manner that floats your boat. To make usage on your website easy a single shortcode is used to return a single conversion, and various attributes alter the output which includes an optional graph.

If you're one of our finance clients you'll be more interested in our Interest Rate and Bank Product APIs, both of which will make your page come alive with dynamic and engaging information. The number of data sources we maintain to ensure our finance and property clients are positioned to take advantage of their market is well and truly in triple digits (in almost all cases we provide an Elementor block or shortcode to return the data to your website).

The Exchange API might be more useful to those in the retail space, but it's also handy for brokers or property agents that work with international markets.

Basic Website Currency Conversions

The single currency conversion is returned to your page via the shortcode of [exchange to="usd" value="1"]%%exchange%%[/exchange], in this case returning $0.75. To return another currency you should simply alter the value. For example, [exchange to="usd" value="5"]US%%exchange%%[/exchange] returns US$3.77.

You'll note that we use the %%exchange%% placeholder. This is used primarily to support currency tooltips. For example, [exchange to="usd" value="100" modal="This is modal text, AU$100 will buy you %%currency%% USD"]US%%exchange%%[/exchange] will return US$75.37 (note the tooltip when you hover over the value). In using placeholders you simply have more control over how the tooltip text is returned.

Shortcode Attributes

Available shortcode attributes are as follows:

from

The from currency. Defaults to aud. Available currency: aud, usd, twi, cny, jpy, eur, krw, gbp, sgd, inr, thb, nzd, twd, myr, idr, vnd, aed, pgk, hkd, cad, zar, sar, chf, sek, php, sdr, dem, frf, esp, itl, nlg, bef, ats, fim, pte, iep, grd.

to

The to currency. Defaults to usd. Available currency: aud, usd, twi, cny, jpy, eur, krw, gbp, sgd, inr, thb, nzd, twd, myr, idr, vnd, aed, pgk, hkd, cad, zar, sar, chf, sek, php, sdr, dem, frf, esp, itl, nlg, bef, ats, fim, pte, iep, grd.

value

The value of the conversion. A dollar value with decimals without the dollar sign (value="5.75").

rate

Rate can be ignored. If set to true it simply returns the default conversion from AUD to USD. It's a partially retired attribute for a custom application.

decimals

The number of decimal values to return in the conversion. Defaults to 2.

background

The modal background colour. Any hex or RGB value is accepted. For example, background="#6CAE6A" or background="rgb(108, 174, 106, 0.8)".

color

The modal text color. Any hex or RGB value is accepted. For example, background="#ffffff" or background="rgb(255, 255, 255)".

modal

The modal text. Should also include the %%exchange%% placeholder. Example: modal="The value of X USD is %%exchange%%".

Currency Graphs

The graphing features made available to clients is quite extensive so we won't introduce them all here. Features to return multiple currencies in a single graph, comparative data, and so on, is all documented in various client manuals.

We return image graphs only because it's the default graphing API we use but you do have the option of rendering more interactive JavaScript graphs when required. The Exchange shortcode utilises the image graph simply because it's easier to use.

The standard RESTful response includes a single array with a key-value pair representing the X and Y axis. An additional attribute of full=true is available and will return various array formats that can easily be used in our own JavaScript graphing plugin, and Google Charts.

Example shortcode of [exchange_graph frequency="day" points="45" currency="usd"] will return the following graph:

Exchange Rate Graph

Pictured: The graph shown is a static image. The chart is quite busy so our JavaScript graphing tools may be more appropriate. The JS API returns a mouseover value when interacting with the X axis. However, the image graphs are faster-loading and more easily integrated into other dynamic applications (such as PDF documents).

A more detailed graph will return something similar to the following (updated daily):

Forex: June, 2021

A candlestick chart is usually more appropriate and tends to add a little colour to the graph; it shown the low and high for each rendered day.

Unlike some of our other image tools, the image is saved to a dedicated directory in our client plugin (identical graphs are sourced from your own archive while dynamic images are cached for a short period). In this way we don't fill up your WordPress media library with unnecessary graphs.

Shortcode attributes include the following:

frequency

The time interval between plots. May be 'day', 'week', or 'month'.

points

The number of data plots to show. In our example above 45 was a little too many for an image graph - around 30 seems to be suitable for a daily graph.

currency

The currency that is rendered in the graph (compared against the Australian Dollar). Defaults to USD. TO return multiple currencies in the same graph use currency="usd,nzd,cad".

start_date, end_date, and days

Used to return a graph with a range of values in a specific data range. The days attribute will always use a current end_date.

graph

Accepted attributes are line, bar, and candlestick. Determines the type of graph to return.

Conclusion

The standard RESTful responses are obviously not documented here simply because the majority of our clients are more interested in the result rather than the method. In brief, the API will return paginated data with all or limited currencies, and up to 100 days per page (with any currency set as the primary value). Multiple formats are returned for quick integration with the most popular graphing applications, including Google Charts.

As mentioned, our standalone JavaScript plugin is usually more appropriate for interactive graphs but the image format is very easy to use, and it makes it far easier on our end when sending articles to participating business websites as part of our article distribution program (we simply include a single shortcode).

While not introduced on this page, the data may be merged with other data sources, such as the Interest Rate API.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Connecticut)

  Want to have a chat?
 

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment

READY TO HAVE A CHAT? CALL US ANYTIME ON 1300 235 433

NOPE