Skip to content

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

Bugfix/fix exception with market state (#602)

Thomas Kauld69a69ce18a4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a34f3a699..707896b008 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgraded `chart.js` from version `3.5.0` to `3.7.0`
- Upgraded `Nx` from version `13.3.0` to `13.4.1`
+### Fixed
+
+- Fixed an exception with the market state caused by a failed data provider request
+
## 1.98.0 - 29.12.2021
### Added
diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts
index e9be3d0a2e..9a44d2d8ea 100644
--- a/apps/api/src/app/portfolio/portfolio.service.ts
+++ b/apps/api/src/app/portfolio/portfolio.service.ts
@@ -662,7 +662,9 @@ export class PortfolioService {
grossPerformancePercentage:
position.grossPerformancePercentage?.toNumber() ?? null,
investment: new Big(position.investment).toNumber(),
- marketState: dataProviderResponses[position.symbol].marketState,
+ marketState:
+ dataProviderResponses[position.symbol]?.marketState ??
+ MarketState.delayed,
name: symbolProfileMap[position.symbol].name,
netPerformance: position.netPerformance?.toNumber() ?? null,
netPerformancePercentage: