Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Add name to position
Thomase0435e5cadec
diff --git a/apps/api/src/app/core/portfolio-calculator.ts b/apps/api/src/app/core/portfolio-calculator.tsindex a0d32f1471..18d852152d 100644--- a/apps/api/src/app/core/portfolio-calculator.ts+++ b/apps/api/src/app/core/portfolio-calculator.ts@@ -56,25 +56,27 @@ export class PortfolioCalculator {const unitPrice = new Big(order.unitPrice);if (oldAccumulatedSymbol) {currentTransactionPointItem = {- quantity: order.quantity- .mul(factor)- .plus(oldAccumulatedSymbol.quantity),- symbol: order.symbol,+ currency: order.currency,+ firstBuyDate: oldAccumulatedSymbol.firstBuyDate,investment: unitPrice.mul(order.quantity).mul(factor).add(oldAccumulatedSymbol.investment),- currency: order.currency,- firstBuyDate: oldAccumulatedSymbol.firstBuyDate,+ name: order.name,+ quantity: order.quantity+ .mul(factor)+ .plus(oldAccumulatedSymbol.quantity),+ symbol: order.symbol,transactionCount: oldAccumulatedSymbol.transactionCount + 1};} else {currentTransactionPointItem = {- quantity: order.quantity.mul(factor),- symbol: order.symbol,- investment: unitPrice.mul(order.quantity).mul(factor),currency: order.currency,firstBuyDate: order.date,+ investment: unitPrice.mul(order.quantity).mul(factor),+ name: order.name,+ quantity: order.quantity.mul(factor),+ symbol: order.symbol,transactionCount: 1};}@@ -147,6 +149,7 @@ export class PortfolioCalculator {: null,investment: item.investment,marketPrice: marketValue?.marketPrice,+ name: item.name,quantity: item.quantity,symbol: item.symbol,transactionCount: item.transactionCount@@ -384,11 +387,12 @@ interface TransactionPoint {}interface TransactionPointSymbol {- quantity: Big;- symbol: string;- investment: Big;currency: Currency;firstBuyDate: string;+ investment: Big;+ name: string;+ quantity: Big;+ symbol: string;transactionCount: number;}@@ -407,10 +411,11 @@ export interface TimelinePeriod {}export interface PortfolioOrder {+ currency: Currency;date: string;+ name: string;quantity: Big;symbol: string;type: OrderType;unitPrice: Big;- currency: Currency;}diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex 1a8bfd5d70..6d39ce0037 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -231,7 +231,7 @@ export class PortfolioService {position.grossPerformancePercentage).toNumber(),investment: new Big(position.investment).toNumber(),- name: '', // TODO+ name: position.name,quantity: new Big(position.quantity).toNumber(),type: Type.Unknown, // TODOurl: '' // TODO@@ -267,12 +267,13 @@ export class PortfolioService {}const portfolioOrders: PortfolioOrder[] = orders.map((order) => ({+ currency: order.currency,date: format(order.date, 'yyyy-MM-dd'),+ name: order.SymbolProfile?.name,quantity: new Big(order.quantity),symbol: order.symbol,type: <OrderType>order.type,- unitPrice: new Big(order.unitPrice),- currency: order.currency+ unitPrice: new Big(order.unitPrice)}));const portfolioCalculator = new PortfolioCalculator(diff --git a/libs/common/src/lib/interfaces/timeline-position.interface.ts b/libs/common/src/lib/interfaces/timeline-position.interface.tsindex 533c09a045..4fb306332a 100644--- a/libs/common/src/lib/interfaces/timeline-position.interface.ts+++ b/libs/common/src/lib/interfaces/timeline-position.interface.ts@@ -9,6 +9,7 @@ export interface TimelinePosition {grossPerformancePercentage: Big;investment: Big;marketPrice: number;+ name: string;quantity: Big;symbol: string;transactionCount: number;