Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix issue on buy date in position detail dialog (#297)
Thomas Kaule17b217032cf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9b372d3c76..4fb619d471 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed- Fixed the node engine version mismatch in `package.json`+- Fixed an issue on the buy date in the position detail dialog## 1.39.0 - 16.08.2021diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex b21b1112a2..f5d904e385 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -337,10 +337,10 @@ export class PortfolioService {);const historicalDataArray: HistoricalDataItem[] = [];- let maxPrice = orders[0].unitPrice;- let minPrice = orders[0].unitPrice;+ let maxPrice = Math.max(orders[0].unitPrice, marketPrice);+ let minPrice = Math.min(orders[0].unitPrice, marketPrice);- if (!historicalData[aSymbol][firstBuyDate]) {+ if (!historicalData?.[aSymbol]?.[firstBuyDate]) {// Add historical entry for buy date, if no historical data availablehistoricalDataArray.push({averagePrice: orders[0].unitPrice,