wealthfolio icon indicating copy to clipboard operation
wealthfolio copied to clipboard

[BUG] Showing wrong currency value at Holdings

Open sertxudev opened this issue 1 year ago • 6 comments

Hi, awesome work!

I've noticed account holdings are shown with the account currency (EUR):

image

These should be:

Total value Today's price
€9,15 ~€9,64~ €4,58 ~€4,82~

The values shown are retrieved from Yahoo finance, which are stored in USD.

image

The account holdings should be converted to EUR (or whatever the account currency is).

The other values in the account are working as expected.

image

So the bug it's only at the account holdings table.

sertxudev avatar Nov 17 '24 16:11 sertxudev

The problem seems to be caused by the calculation logic in the HoldingsService. It's using the holding currency instead of the asset currency to get the exchange rate.

Additionally, there's book_value_converted field that doesn't make much sense to me, since it's not calculated using the exchange rate from day of the activity but the current exchange rate

It gets even more interesting when you have 3 currencies in the setup.

  1. Set up currency A as a base currency
  2. Add 2 accounts with B and C currencies
  3. Add the same BUY activity of any asset to both accounts and compare the numbers on the account and holdings pages

I think the discrepancies come from the confusion around book_value For examample if we have an account in currency B but the asset currency is C, then the value of market_value is in currency C but book_value is in currency B. What's even more confusing both of values are converted using the same exchange rate to the base account currency A this code does that

MarcinFrankowski avatar Nov 22 '24 12:11 MarcinFrankowski

I was able to fix the values on Account Holdings page with some debatable calculation changes, but discovered that the same logic is used for the Holdings Page and the fix can't be applied to display correct value on both pages. My take is that the root cause is the data model structure. The Holding class has values in different currencies. The currency conversion needs to be improved, and it should take into account the context of where the values are presented. For example it should use the account currency on the Account Holdings page and base currency on the Holdings page.

The Holding page gets more complicated when you have the same asset on two account with different currencies. Right now it will add simply add the book values even if the currency does not match (ie. 100$ + 100€ = 200$)

MarcinFrankowski avatar Nov 25 '24 15:11 MarcinFrankowski

Same problem here with VWCE and XEON stocks.

rafaelgreca avatar Dec 01 '24 15:12 rafaelgreca

Can you please confirm if this issue is resolved in the latest version

afadil avatar Jun 11 '25 18:06 afadil

Not sure if this is a different issue, but for me the holdings still use the wrong currency on the "Holdings overview" page. Edit: This is in version 1.1.4 from last week.

I have holdings in EUR, USD, and DKK (and some others) and main currency is EUR. Say one holding has DKK 10.000 and another EUR 10.000

In the "Holding composition" they show up equal size/weight, eventhough EUR/DKK is approx 1/7.5; the DKK holding should be 1/7th of the EUR holding. Hovering the DKK holding even shows "Market value €10.000" instead of the expected "Market value DKK 10.000" or "Market value EUR 1333.33".

Clicking through to the details of the holding does show everything correctly in DKK. Though I won't mind seeing the holding total in EUR (main currency) next to, below, or instead of the DKK value.

berkes avatar Jun 26 '25 13:06 berkes

Image

Not sure if it's the same issue, but i'm trying to track Gold using GC=F but instead of using the actual currency USD, it's using my base currency

Ripwords avatar Aug 09 '25 05:08 Ripwords