#7900·ghostfolio

[BUG] Average unit price line misaligned in holding detail chart for own (MANUAL) asset profiles

Author: oceanjustinlinCreated Sep 18, 2026Updated Sep 18, 2026

Bug Description

In the holding detail dialog, the average unit price line (benchmark dataset) is plotted at the wrong dates when the asset profile is owned by the user (e.g. MANUAL data source) and its market data history starts before the first activity.

The line is drawn starting at the very left of the chart and stops partway through, instead of starting at the date of the first activity and running to today.

Root cause

  1. holding-detail-dialog.component.ts first builds historicalDataItems and benchmarkDataItems from the holding's historicalData. Both arrays have the same length and start at the date of the first activity.

  2. When hasPermissionToReadMarketDataOfOwnAssetProfile && isOwnAssetProfile, fetchMarketData() then replaces historicalDataItems with the full market data series of the symbol. benchmarkDataItems is left unchanged, so the two arrays now differ in length and start date.

  3. line-chart.component.ts pairs the two datasets by array index, not by date:

    typescript
    this.historicalDataItems?.forEach((historicalDataItem, index) => {
      benchmarkPrices.push(this.benchmarkDataItems?.[index]?.value);
      ...
    });

    As a result, the N benchmark points are mapped onto the first N market data dates.

To Reproduce

  1. Create a MANUAL asset profile and add daily market data starting at e.g. 2025-01-02 (415 data points up to 2026-09-16)
  2. Add the first BUY activity on 2026-01-09, followed by more activities (the holding's historicalData has 168 points)
  3. Open the holding detail dialog of this symbol
  4. The average unit price line covers roughly the first 168/415 ≈ 40% of the x-axis (2025-01 to ~2025-09), a period in which there was no holding, and is missing from 2026-01-09 onwards

Expected behavior

The average unit price line is aligned by date with the market price line: empty before the first activity, then running from 2026-01-09 until today.

Possible fixes:

  • In line-chart.component.ts, look up the benchmark value by date (e.g. via a Map<date, value>) instead of by index, or
  • In fetchMarketData(), rebuild benchmarkDataItems on the new date axis (null for dates before the first activity)

Screenshots

Screenshot will be added in a follow-up comment.

Logs

n/a (no errors, rendering issue only). Portfolio calculations (average price, value, performance) are correct.

Environment

  • Ghostfolio Version: 3.70.1 (also verified that the code is unchanged on main as of 2026-09-18)
  • Self-hosted (Docker)
  • Data source: MANUAL
  • OS: macOS

Additional context

Holdings based on non-owned asset profiles (e.g. YAHOO) are not affected, since fetchMarketData() is only called for own asset profiles.