#5675·ghostfolio

[BUG] Portfolio Value Incorrectly Drops After Adding a Dividend When Market Price is Unavailable

Author: KenTandrianCreated Oct 4, 2025Updated Sep 4, 2026

Bug Description

When a live market price for an asset cannot be fetched, the system incorrectly uses the unitPrice of the most recent transaction as a fallback for the current market price. If the most recent transaction is a dividend, the system uses the dividend-per-share amount as the asset's market price. This leads to a significant and incorrect drop in the calculated value of the holding and the overall portfolio.

I believe the root cause is in the CurrentRateService.getValues method. When a live quote fails, the fallback logic fetches the latest activity for the symbol, regardless of its type (including DIVIDEND), and uses its unitPrice as the current marketPrice.

To Reproduce

  1. Choose an existing holding in your portfolio, preferably one for which live market data might be temporarily unavailable.
  2. Add a DIVIDEND transaction for this asset. Make this the most recent transaction for this holding.
  3. Go to the Holdings page or any view that displays the current market value of your portfolio.
  4. Observe that the market price for the holding now reflects the dividend-per-share amount, and the total value of the holding has dropped significantly.

Expected Behavior

When a live market price is unavailable, the system should use a more appropriate fallback. The order of preference should be:

  1. The previous day's closing market price.
  2. If no historical data is available, the unitPrice of the most recent trade activity (BUY or SELL).
  3. The unitPrice of a DIVIDEND transaction should never be used as a fallback for the market price.

If no valid fallback price can be found, the market price should be displayed as null, and the holding's value should not be calculated based on an incorrect price.

Screenshots

Image

My latest activity:

Image

Logs

I tried logging the unitPriceAtEndDate and latestActivity.unitPrice, both showing the dividend-per-share price:

bash
unitPriceAtEndDate 0.01
latestActivity.unitPrice 0.01

Environment

  • Ghostfolio Version 2.205.0
  • Self-hosted
  • Experimental Features enabled
  • Chrome Browser
  • macOS

Additional Context

The fallback logic is located in apps/api/src/app/portfolio/current-rate.service.ts within the getValues method.

https://github.com/ghostfolio/ghostfolio/blob/3f2d045e1fcdbde83c1a56d5667b9ab33f40f1f6/apps/api/src/app/portfolio/current-rate.service.ts#L132-L135

The call to this.orderService.getLatestOrder does not distinguish between activity types, leading it to pick up dividend transactions.