Skip to main content

Currency Conversion

AutoExtract will automatically detect pairs of currency names and values, and convert them to a target currency of your choice (e.g., USD) using the latest exchange rates. This allows you to normalize financial amounts from different currencies to a target currency to make comparisons over time more consistent.

The data can either be in fields extracted from the message, or in any custom JSON fields submitted with each event.

Forex rates are provided by Open Exchange Rates and over 200 source currencies are supported. The target currency defaults to USD and you can choose from AUD, CAD, CHF, CNY, EUR, GBP, INR, JPY, and USD. Contact us to request support for another target currency. Currency conversion rates are automatically updated daily.

How it works

In any JSON object within each event (at any level), if any supported 3-digit currency code is detected in any field that has the name currency in it, then it will convert any numeric value field that contains one of the following words: amount, value, price, cost, charge, revenue, total, or balance. The converted field will have the name (originalname)_(targetcurrency) (e.g., amount_usd) as well as in fields (originalname)_converted and (originalname)_converted_currency (will store the target currency code). It will perform the conversion on all matching currency value fields in any JSON object where a currency code field is detected.

If the value field is an array with only numeric values, then it will perform the currency conversion on each value in the array and store it into a new array field. If the value field already has the base currency in the name it will not convert it (e.g., amount_usd will not be converted to amount_usd_usd).

You can customize the target currency and the words that denote currency code and currency value fields by customizing the X-Target-Currency, X-Currency-Code-Field-Words, and X-Currency-Value-Field-Words HTTP request headers.

Examples

Give this simple example a try:


Here's a more complex example: