Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
fix position diagram for sold items (#261)
Valentin Zickner218efbb5bd27
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5e3e21ee6e..b774d54ff7 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 an issue with the currency conversion of the market price in the position detail dialog+- Fixed the chart and missing data of positions from the past in the position detail dialog## 1.33.0 - 05.08.2021diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex 5bb2a7114b..71a08d1a36 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -391,6 +391,7 @@ export class PortfolioService {};} else {const currentData = await this.dataProviderService.get([aSymbol]);+ const marketPrice = currentData[aSymbol]?.marketPrice;let historicalData = await this.dataProviderService.getHistorical([aSymbol],@@ -408,28 +409,33 @@ export class PortfolioService {}const historicalDataArray: HistoricalDataItem[] = [];+ let maxPrice = marketPrice;+ let minPrice = marketPrice;for (const [date, { marketPrice }] of Object.entries(historicalData[aSymbol]- ).reverse()) {+ )) {historicalDataArray.push({date,value: marketPrice});++ maxPrice = Math.max(marketPrice ?? 0, maxPrice);+ minPrice = Math.min(marketPrice ?? Number.MAX_SAFE_INTEGER, minPrice);}return {- averagePrice: undefined,+ marketPrice,+ maxPrice,+ minPrice,+ averagePrice: 0,currency: currentData[aSymbol]?.currency,firstBuyDate: undefined,grossPerformance: undefined,grossPerformancePercent: undefined,historicalData: historicalDataArray,- investment: undefined,- marketPrice: currentData[aSymbol]?.marketPrice,- maxPrice: undefined,- minPrice: undefined,- quantity: undefined,+ investment: 0,+ quantity: 0,symbol: aSymbol,transactionCount: undefined};diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.htmlindex fbd54e14fe..870ec1fbef 100644--- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html+++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html@@ -1,7 +1,7 @@<gf-dialog-headermat-dialog-title[deviceType]="data.deviceType"- [title]="data.title"+ [title]="data.title ?? data.symbol"(closeButtonClicked)="onClose()"></gf-dialog-header>