Open source projects and tools.
dated-money
A Python library for date-aware currency operations Updated 2025-08-15: v2.x with DM factory, robust fallback for historical rates, and SQLite/PostgreSQL serialization helpers. dated-money represents monetary values with an optional date and performs conversions using historical exchange rates with automatic fallback. https://github.com/juanre/dated-money Installation uv add dated-money or pip install dated-money Quickstart from dated_money import DM, DatedMoney, Currency # Factory: default currency/date Eur = DM('EUR', '2024-01-01') # Create amounts price = Eur(100) # €100.00 from_usd = Eur(50, '$') # $50 → EUR (on 2024-01-01) # Arithmetic: result in the second operand's currency/date a = DatedMoney(100, 'EUR', '2024-01-01') b = DatedMoney(50, 'USD', '2024-01-01') res = a + b # result in USD on 2024-01-01 # Convert and format print(res.to('EUR')) # €... print(str(res)) # e.g. $... (rounded to cents) print(repr(res)) # '2024-01-01 USD ...' (parseable) # Parse from repr parsed = DatedMoney.parse('2024-01-01 EUR 100.50') assert parsed == DatedMoney(100.50, 'EUR', '2024-01-01') Notes: ...