Skip to content

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

Bugfix/filter out positions without quantity (#317)

Thomas Kaulc5bb3023d3a4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf0e810840..916044ae02 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
+
+- Filtered out positions without any quantity in the positions table
+
## 1.43.0 - 24.08.2021
### Added
diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts
index 5f77ef58d5..19fbf91e8a 100644
--- a/apps/api/src/app/portfolio/portfolio.service.ts
+++ b/apps/api/src/app/portfolio/portfolio.service.ts
@@ -211,6 +211,11 @@ export class PortfolioService {
}
for (const item of currentPositions.positions) {
+ if (item.quantity.lte(0)) {
+ // Ignore positions without any quantity
+ continue;
+ }
+
const value = item.quantity.mul(item.marketPrice);
const symbolProfile = symbolProfileMap[item.symbol];
const dataProviderResponse = dataProviderResponses[item.symbol];