The macro builds an interactive table that fetches and displays exchange rates for a user-specified base currency. Major currencies (e.g., USD, EUR) are filtered from the response and presented with corresponding country flags.
#set($baseCurrency = $parameters.baseCurrency)
## Define the API URLs
#set($exchangeRateApiUrl = "https://open.er-api.com/v6/latest/$baseCurrency")
#set($flagApiBaseUrl = "https://flagsapi.com/")
## Fetch exchange rate data
#set($exchangeResponse = $RequestManager.get($exchangeRateApiUrl))
## Check if data fetch was successful
#if($exchangeResponse)
#set($exchangeData = $exchangeResponse.rates)
## Major currencies list (customizable)
#set($majorCurrencies = ["USD", "EUR", "GBP", "JPY", "CHF", "CAD", "AUD"])
<table class="aui aui-table-interactive aui-table-rowhover" style="width: 50%; table-layout: fixed; border-collapse: collapse;">
<thead>
<tr>
<th style="width: 50%;">Currency</th>
<th style="width: 50%;">Rate ($baseCurrency)</th> ## Updated header
</tr>
</thead>
<tbody>
## Loop over the available currencies in the response and display only major currencies, excluding the base currency
#foreach($currency in $exchangeData.keySet())
#if($currency != $baseCurrency) ## Skip the base currency
## Check if the currency is in the majorCurrencies list by manual iteration
#set($isMajorCurrency = false)
#foreach($majorCurrency in $majorCurrencies)
#if($currency == $majorCurrency)
#set($isMajorCurrency = true)
#end
#end
## Display only if it's a major currency
#if($isMajorCurrency)
<tr>
<td>
#if($currency == "EUR")
<span style="margin-right: 5px; vertical-align: middle;">
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b7/Flag_of_Europe.svg" alt="EU flag" style="width: 20px; height: 15px;">
</span>
$currency
#else
<span style="margin-right: 5px; vertical-align: middle;">
<img src="${flagApiBaseUrl}${currency.substring(0,2)}/shiny/32.png" alt="$currency flag" style="width: 20px; height: 20px;">
</span>
$currency
#end
</td>
<td>$MathTool.roundTo(3, $exchangeData.get($currency))</td> ## Rounding rate to 2 decimal places
</tr>
#end
#end
#end
</tbody>
</table>
#else
<p>
Failed to retrieve exchange rates.
</p>
#endGet the latest cryptocurrency exchange rates for major coins
Convert a specified amount of cryptocurrency to a fiat currency
Parse a table containing cost and currency columns, convert each row's value into a selected target currency, and append a footer row showing the total amount. Useful for tracking multi-currency expenses and reporting totals in a unified currency.
Display Confluence page edit and view restrictions to provide essential permission details, including users, groups, and inherited access
Display the creation date of the current Confluence page
Display and interact with an OpenAPI/Swagger specification directly in Confluence by rendering a fully featured Swagger UI from a provided JSON URL
Show confetti bursts and a motivational message upon saving an edited page
Based on CQL, show a table with the following columns: Page Title, Author, Updated, and Status
Display a custom list of recently updated content
Show H1 headings for child topics to enable easy navigation