Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/handle X-ray rule exception when market price is missing (#6397)

Abhishek Garg48f1c064bc73
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f806a260e3..6b1a1c9780 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+### Fixed
+
+- Fixed an exception by adding a fallback for missing market price values on the _X-ray_ page
+
## 2.243.0 - 2026-02-23
### Changed
diff --git a/apps/api/src/models/rule.ts b/apps/api/src/models/rule.ts
index 9c27e0018a..622375b5b1 100644
--- a/apps/api/src/models/rule.ts
+++ b/apps/api/src/models/rule.ts
@@ -57,7 +57,7 @@ export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
previousValue +
this.exchangeRateDataService.toCurrency(
new Big(currentValue.quantity)
- .mul(currentValue.marketPrice)
+ .mul(currentValue.marketPrice ?? 0)
.toNumber(),
currentValue.currency,
baseCurrency