Ghostfolio Widget Currency Handling#
The Ghostfolio homepage widget supports a net_worth field that displays the user's current portfolio net worth alongside a currency code. Prior to PR #7116, there was a bug where the wrong currency was displayed — the widget read userInfo?.settings?.currency instead of userInfo?.settings?.baseCurrency, which is the field Ghostfolio actually uses for the portfolio's base currency. This bug has been fixed as of PR #7116.
How Currency Resolution Works#
When net_worth is included in the widget's fields list, the component fetches the Ghostfolio v1/user endpoint via a userInfo API mapping. The net worth value is then rendered as a string combining the numeric value with the currency code .
Prior to the fix, the buggy line was:
performanceToday.performance.currentNetWorth.toFixed(2) + " " + userInfo?.settings?.currency ?? ""
After PR #7116, the code correctly uses:
performanceToday.performance.currentNetWorth.toFixed(2) + " " + userInfo?.settings?.baseCurrency ?? userInfo?.settings?.currency ?? ""
The Ghostfolio /v1/user response contains a settings object with two distinct currency fields:
| Field | Meaning |
|---|---|
settings.baseCurrency | The portfolio's configured base currency (e.g., EUR) — this is what Ghostfolio uses for valuation |
settings.currency | The user's display/preference currency — may differ from the portfolio base currency |
The widget previously read settings.currency, but the net worth value from currentNetWorth is denominated in settings.baseCurrency. This mismatch caused the displayed currency label to be wrong when the two fields differed — for example, showing USD when the portfolio was actually valued in EUR.
The Bug (Fixed)#
Prior to PR #7116, the bug existed in:
- File:
src/widgets/ghostfolio/component.jsx, line 58 - Incorrect field (old):
userInfo?.settings?.currency - Correct field (fixed):
userInfo?.settings?.baseCurrency
The unit test previously mocked settings: { currency: "USD" } and did not cover the case where baseCurrency differed from currency, so the test passed despite the bug. PR #7116 updated the test to mock settings: { baseCurrency: "EUR", currency: "USD" } and added a fallback test case, ensuring the fix is properly validated.
Implemented Fix#
PR #7116 implemented the fix with a backward compatibility fallback :
userInfo?.settings?.baseCurrency ?? userInfo?.settings?.currency ?? ""
This ensures the portfolio base currency is used first, falling back to settings.currency for any older Ghostfolio versions that may not expose baseCurrency. The widget now correctly displays net worth in the portfolio's base currency.
Background: How net_worth Was Added#
The net_worth field and userInfo API call were introduced in PR #5958 (merged November 2025). The userInfo endpoint mapping was added to widget.js at that time, pointing to v1/user. The currency was pulled from settings.currency in the original implementation without accounting for Ghostfolio's distinction between currency and baseCurrency.
Key Files#
| File | Purpose |
|---|---|
src/widgets/ghostfolio/component.jsx | Widget UI — contained the buggy currency field access at line 58 (fixed in PR #7116) |
src/widgets/ghostfolio/widget.js | API endpoint mappings, including userInfo → v1/user |
src/widgets/ghostfolio/component.test.jsx | Unit tests — updated in PR #7116 to include baseCurrency in test mocks and validate the fix |
Widget Configuration Reference#
The widget supports these fields : gross_percent_today, gross_percent_1y, gross_percent_max, net_worth. Currency is only relevant when net_worth is enabled.