[BUG] Average unit price line misaligned in holding detail chart for own (MANUAL) asset profiles
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
holding-detail-dialog.component.tsfirst buildshistoricalDataItemsandbenchmarkDataItemsfrom the holding'shistoricalData. Both arrays have the same length and start at the date of the first activity.When
hasPermissionToReadMarketDataOfOwnAssetProfile && isOwnAssetProfile,fetchMarketData()then replaceshistoricalDataItemswith the full market data series of the symbol.benchmarkDataItemsis left unchanged, so the two arrays now differ in length and start date.line-chart.component.tspairs the two datasets by array index, not by date: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
- Create a
MANUALasset profile and add daily market data starting at e.g.2025-01-02(415 data points up to2026-09-16) - Add the first
BUYactivity on2026-01-09, followed by more activities (the holding'shistoricalDatahas 168 points) - Open the holding detail dialog of this symbol
- 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 aMap<date, value>) instead of by index, or - In
fetchMarketData(), rebuildbenchmarkDataItemson the new date axis (nullfor 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
mainas 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.
Source: ghostfolio/ghostfolio