When entering in a foreign exchange rate you can configure a lookup to query an online source for exchange rates. To lookup the rate select Base and Foreign Currencies and a Date and click ‘Lookup Rate’

The following settings are used to configure the lookup. Each setting is a value in the Settings table and can be modified on the ‘All’ tab in ‘Options’. If no URL has been configured, the Lookup Rate link will not be visible. See examples below.

JSON Example

Using the following settings will use the Valet service provided by Bank of Canada and will return daily exchange rates between the selected date and 30 days prior to the selected date. The rates are returned in chronological order from oldest to newest so we write the response path using JSONPath syntax to find the last observation and grab the value for the property 'v' which holds the decimal value of the exchange rate.

Setting Values in Crows Nest:

ExchangeRateLookup_URL: https://www.bankofcanada.ca/valet/observations/FX<basecurrency><foreigncurrency>/json?start_date=<date-30>&end_date=<date>
ExchangeRateLookup_ResponseFormat: JSON
ExchangeRateLookup_ResponsePath: $.observations[-1:]..v

XML Example

Using the following settings will use the Valet service provided by Bank of Canada and will return daily exchange rates between the selected date and 30 days prior to the selected date. The rates are returned in chronological order from oldest to newest so we write the response path using XPath syntax to find the last observation and grab the value for the property 'v' which holds the decimal value of the exchange rate.

Setting Values in Crows Nest:

ExchangeRateLookup_URL: https://www.bankofcanada.ca/valet/observations/FX<basecurrency><foreigncurrency>/xml?start_date=<date-30>&end_date=<date>
ExchangeRateLookup_ResponseFormat: XML
ExchangeRateLookup_ResponsePath: //o[last()]/v