From 3359ea1d2027cab75eeedf72b610e76008074292 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 17 Jan 2026 11:46:41 +0100 Subject: [PATCH] Bugfix/numeric parsing error in X-ray page (#6198) * Fix numeric parsing error related to cash positions * Update changelog --- CHANGELOG.md | 4 ++++ .../api/src/app/portfolio/calculator/portfolio-calculator.ts | 5 ++--- .../calculator/roai/portfolio-calculator-cash.spec.ts | 2 +- .../calculator/roai/portfolio-calculator-valuable.spec.ts | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 779b24981..c7757c1c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed the deprecated platforms from the info service - Removed the deprecated activities from the endpoint `GET api/v1/portfolio/holding/:dataSource/:symbol` +### Fixed + +- Fixed a numeric parsing error related to cash positions on the _X-ray_ page + ## 2.230.0 - 2026-01-14 ### Added diff --git a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts index 8f6cb0efc..dfc39afa5 100644 --- a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts +++ b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts @@ -433,9 +433,8 @@ export abstract class PortfolioCalculator { investment: totalInvestment, investmentWithCurrencyEffect: totalInvestmentWithCurrencyEffect, marketPrice: - marketSymbolMap[endDateString]?.[item.symbol]?.toNumber() ?? null, - marketPriceInBaseCurrency: - marketPriceInBaseCurrency?.toNumber() ?? null, + marketSymbolMap[endDateString]?.[item.symbol]?.toNumber() ?? 1, + marketPriceInBaseCurrency: marketPriceInBaseCurrency?.toNumber() ?? 1, netPerformance: !hasErrors ? (netPerformance ?? null) : null, netPerformancePercentage: !hasErrors ? (netPerformancePercentage ?? null) diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts index f5a4ca634..c9adebc44 100644 --- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts +++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts @@ -247,7 +247,7 @@ describe('PortfolioCalculator', () => { includeInTotalAssetValue: false, investment: new Big(1820), investmentWithCurrencyEffect: new Big(1750), - marketPrice: null, + marketPrice: 1, marketPriceInBaseCurrency: 0.91, netPerformance: new Big(0), netPerformancePercentage: new Big(0), diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts index 3c7c3be4b..1db133288 100644 --- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts +++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts @@ -129,7 +129,7 @@ describe('PortfolioCalculator', () => { grossPerformanceWithCurrencyEffect: new Big('0'), investment: new Big('500000'), investmentWithCurrencyEffect: new Big('500000'), - marketPrice: null, + marketPrice: 1, marketPriceInBaseCurrency: 500000, netPerformance: new Big('0'), netPerformancePercentage: new Big('0'),