Skip to content

Better multi-currency support - #131

Open
zbrox wants to merge 7 commits into
bscott:mainfrom
zbrox:fix/analytics-multicurrency
Open

Better multi-currency support#131
zbrox wants to merge 7 commits into
bscott:mainfrom
zbrox:fix/analytics-multicurrency

Conversation

@zbrox

@zbrox zbrox commented Jul 18, 2026

Copy link
Copy Markdown

Hey,

Since I am dealing with a bunch of different (from the default) currencies in my subscriptions I noticed that they don't mix very well. The absolute values are used to do aggregations, foreign currency values are displayed on the calendar with the default currency symbol, etc. Going over that I realized that some changes were also needed for the Fixer.io integration so it's used more evenly throughout. Also I wanted to make sure API calls are lowered to a minimum to be able to stay within the free tier of 100 calls per month as much as possible. No proper lock is implemented so technically there can be more calls made in certain cases I think, but it should be ok as is now.

This is a bit extensive but shouldn't require any data migrations. From my own local tests (with and without a fixer api key, with or without fetched and cached exchange rates) it looks pretty ok.

I tried to keep decisions on changes to a minimum. I understand it is still quite hefty for a PR. Hopefully I kept to the convention of the project and it's not too cumbersome for review.

Here's a not so short list of the changes included here:

  • Derive cross-currency rates from cached EUR-based rates, allowing one Fixer snapshot to serve every supported currency pair
  • Persist a 24-hour cooldown after each automatic Fixer refresh attempt, including failed attempts, reducing repeated calls across subsequent requests and application restarts
  • Fall back to stale cached rates when Fixer is unavailable, its quota is exhausted, or no API key is configured
  • Indicate when subscription values use stale cached rates and show the date of those rates
  • Convert dashboard and analytics totals into the preferred currency when all required rates are available
  • Show totals grouped by original currency when any required rate is missing, avoiding invalid mixed-currency sums
  • Hide category percentage bars when currencies cannot be safely combined (I was not really sure what is a good solution here)
  • Apply conversion-aware statistics consistently to the dashboard, analytics, stats API, backups, and MCP endpoint
  • Display calendar costs in the preferred currency when conversion is available, falling back to the original amount and symbol otherwise
  • Sort subscriptions using their converted displayed costs when the required rates are available. When rates are unavailable, group cost sorting by currency and sort numerically within each group
  • Remove the obsolete raw SQL category-statistics path replaced by conversion-aware aggregation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant