Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/rename share to allocation in columns of positions table (#93)
Thomas111d8d8e3c76
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4bfd2dd3d2..0a3808b6eb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Refactored the active menu item state by parsing the current url- Used a desaturated background color for unknown types in pie charts+- Renamed the columns _Initial Share_ and _Current Share_ to _Initial Allocation_ and _Current Allocation_ in the positions table### Fixeddiff --git a/apps/api/src/app/portfolio/interfaces/portfolio-position.interface.ts b/apps/api/src/app/portfolio/interfaces/portfolio-position.interface.tsindex 4f35309404..5184d18889 100644--- a/apps/api/src/app/portfolio/interfaces/portfolio-position.interface.ts+++ b/apps/api/src/app/portfolio/interfaces/portfolio-position.interface.ts@@ -5,6 +5,8 @@ export interface PortfolioPosition {accounts: {[name: string]: { current: number; original: number };};+ allocationCurrent: number;+ allocationInvestment: number;currency: Currency;exchange?: string;grossPerformance: number;@@ -18,8 +20,6 @@ export interface PortfolioPosition {name: string;quantity: number;sector?: string;- shareCurrent: number;- shareInvestment: number;transactionCount: number;symbol: string;type?: string;diff --git a/apps/api/src/models/portfolio.spec.ts b/apps/api/src/models/portfolio.spec.tsindex 5831373a36..e1f6d3cc97 100644--- a/apps/api/src/models/portfolio.spec.ts+++ b/apps/api/src/models/portfolio.spec.ts@@ -188,6 +188,8 @@ describe('Portfolio', () => {)}},+ // allocationCurrent: 0.9999999559148652,+ allocationInvestment: 1,currency: Currency.USD,exchange: UNKNOWN_KEY,grossPerformance: 0,@@ -201,8 +203,6 @@ describe('Portfolio', () => {marketState: MarketState.open,name: 'Bitcoin USD',quantity: 1,- // shareCurrent: 0.9999999559148652,- shareInvestment: 1,symbol: 'BTCUSD',transactionCount: 1,type: 'Cryptocurrency'@@ -289,6 +289,8 @@ describe('Portfolio', () => {)}},+ // allocationCurrent: 1,+ allocationInvestment: 1,currency: Currency.USD,exchange: UNKNOWN_KEY,// grossPerformance: 0,@@ -301,8 +303,6 @@ describe('Portfolio', () => {// marketPrice: 57973.008,name: 'Ethereum USD',quantity: 0.2,- // shareCurrent: 1,- shareInvestment: 1,transactionCount: 1,symbol: 'ETHUSD',type: 'Cryptocurrency'diff --git a/apps/api/src/models/portfolio.ts b/apps/api/src/models/portfolio.tsindex c82072becf..3451bd63c1 100644--- a/apps/api/src/models/portfolio.ts+++ b/apps/api/src/models/portfolio.ts@@ -39,6 +39,7 @@ import { IOrder } from '../services/interfaces/interfaces';import { RulesService } from '../services/rules.service';import { PortfolioInterface } from './interfaces/portfolio.interface';import { Order } from './order';+import { OrderType } from './order-type';import { AccountClusterRiskCurrentInvestment } from './rules/account-cluster-risk/current-investment';import { AccountClusterRiskInitialInvestment } from './rules/account-cluster-risk/initial-investment';import { AccountClusterRiskSingleAccount } from './rules/account-cluster-risk/single-account';@@ -285,6 +286,14 @@ export class Portfolio implements PortfolioInterface {...data[symbol],accounts,symbol,+ allocationCurrent:+ this.exchangeRateDataService.toCurrency(+ portfolioItem.positions[symbol].quantity * now,+ data[symbol]?.currency,+ this.user.Settings.currency+ ) / value,+ allocationInvestment:+ portfolioItem.positions[symbol].investment / investment,grossPerformance: roundTo(portfolioItemsNow.positions[symbol].quantity * (now - before),2@@ -292,14 +301,6 @@ export class Portfolio implements PortfolioInterface {grossPerformancePercent: roundTo((now - before) / before, 4),investment: portfolioItem.positions[symbol].investment,quantity: portfolioItem.positions[symbol].quantity,- shareCurrent:- this.exchangeRateDataService.toCurrency(- portfolioItem.positions[symbol].quantity * now,- data[symbol]?.currency,- this.user.Settings.currency- ) / value,- shareInvestment:- portfolioItem.positions[symbol].investment / investment,transactionCount: portfolioItem.positions[symbol].transactionCount};});@@ -537,12 +538,12 @@ export class Portfolio implements PortfolioInterface {this.orders.push(new Order({account: order.Account,- currency: <any>order.currency,+ currency: order.currency,date: order.date.toISOString(),fee: order.fee,quantity: order.quantity,symbol: order.symbol,- type: <any>order.type,+ type: <OrderType>order.type,unitPrice: order.unitPrice}));diff --git a/apps/client/src/app/components/positions-table/positions-table.component.html b/apps/client/src/app/components/positions-table/positions-table.component.htmlindex 2c7901a326..1bc05e8811 100644--- a/apps/client/src/app/components/positions-table/positions-table.component.html+++ b/apps/client/src/app/components/positions-table/positions-table.component.html@@ -1,7 +1,7 @@<tableclass="gf-table w-100"matSort- matSortActive="shareCurrent"+ matSortActive="allocationCurrent"matSortDirection="desc"mat-table[dataSource]="dataSource"@@ -36,7 +36,7 @@</td></ng-container>- <ng-container matColumnDef="shareInvestment">+ <ng-container matColumnDef="allocationInvestment"><th*matHeaderCellDefclass="justify-content-end px-1"@@ -44,20 +44,20 @@mat-header-cellmat-sort-header>- Initial Share+ Initial Allocation</th><td mat-cell *matCellDef="let element"><div class="d-flex justify-content-end px-1"><gf-value[isPercent]="true"[locale]="locale"- [value]="isLoading ? undefined : element.shareInvestment"+ [value]="isLoading ? undefined : element.allocationInvestment"></gf-value></div></td></ng-container>- <ng-container matColumnDef="shareCurrent">+ <ng-container matColumnDef="allocationCurrent"><th*matHeaderCellDefclass="justify-content-end px-1"@@ -65,14 +65,14 @@mat-header-cellmat-sort-header>- Current Share+ Current Allocation</th><td *matCellDef="let element" class="px-1" mat-cell><div class="d-flex justify-content-end"><gf-value[isPercent]="true"[locale]="locale"- [value]="isLoading ? undefined : element.shareCurrent"+ [value]="isLoading ? undefined : element.allocationCurrent"></gf-value></div></td>diff --git a/apps/client/src/app/components/positions-table/positions-table.component.ts b/apps/client/src/app/components/positions-table/positions-table.component.tsindex e934417ca5..abc90c8d7c 100644--- a/apps/client/src/app/components/positions-table/positions-table.component.ts+++ b/apps/client/src/app/components/positions-table/positions-table.component.ts@@ -73,8 +73,8 @@ export class PositionsTableComponent implements OnChanges, OnInit {this.displayedColumns = ['symbol','performance',- 'shareInvestment',- 'shareCurrent'+ 'allocationInvestment',+ 'allocationCurrent'];this.isLoading = true;diff --git a/apps/client/src/app/pages/analysis/analysis-page.component.ts b/apps/client/src/app/pages/analysis/analysis-page.component.tsindex 9f889e1e78..e8b7498b05 100644--- a/apps/client/src/app/pages/analysis/analysis-page.component.ts+++ b/apps/client/src/app/pages/analysis/analysis-page.component.ts@@ -108,8 +108,8 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {type: position.type,value:aPeriod === 'original'- ? position.shareInvestment- : position.shareCurrent+ ? position.allocationInvestment+ : position.allocationCurrent};this.positionsArray.push(position);