shutupflanders / moneydashboard

Python library for MoneyDashboard
MIT License
12 stars 4 forks source link

Format currencies properly #5

Closed m-roberts closed 3 years ago

m-roberts commented 4 years ago
from babel.numbers import format_currency

# Current method
balance['net_balance'] = float(self.moneyfmt(Decimal(balance['net_balance']), 2, '', ''))

# Conceptual method to format properly
net_balance = format_currency(balances_result['net_balance'], "GBP", locale='en_GB')
shutupflanders commented 4 years ago

Before I implement something like this, are we 100% certain MoneyDashboard don't support other currencies? I don't have a Revolut to test with at the moment, but they offer separate accounts for the currencies you hold as far as I'm aware.

m-roberts commented 4 years ago

I don't see anything in the response that can be used to determine the currency - I would say that it's reasonable to assume GBP, and someone can submit a PR if necessary? Besides, how can a total balance be calculated if the numbers don't add up? They'd all need to be the same currency for that to make sense.