'Format currency in python following google's currency search format

I'm looking for a while now to find a way to format a currency retrieved from fixer.io to match the same format of google's result.

Fixer amount (RUB to USD) is 0.009244 while google's amount (RUB to USD) is 0.0093. I'm noticing here that the last 2 decimals are rounded but searching for another currency and amount fixer returns 440.9402 (USD TO RON) while google returns (USD TO RON) 441.00.

I don't understand how the currency formatting works here and what algorithm it used.

So far I was using "{:,.2f}".format(amount) to format my currency and the problem is that the result it's not accurate: 0.009244 becomes 0.01 and 440.9402 becomes 440.94



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source