Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/introduce Promise.all() in getPerformance() of portfolio service (#4381)
Thomas Kaul8b353fbf66ae
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e1adcd3baf..2922327540 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- Optimized the asynchronous operations using `Promise.all()` in the portfolio service (`getPerformance`)- Improved the symbol lookup in the _Trackinsight_ data enhancer for asset profile data### Fixeddiff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.tsindex d4dc42d916..ce03c80249 100644--- a/apps/api/src/app/portfolio/portfolio.service.ts+++ b/apps/api/src/app/portfolio/portfolio.service.ts@@ -1081,19 +1081,18 @@ export class PortfolioService {const user = await this.userService.user({ id: userId });const userCurrency = this.getUserCurrency(user);- const accountBalanceItems =- await this.accountBalanceService.getAccountBalanceItems({+ const [accountBalanceItems, { activities }] = await Promise.all([+ this.accountBalanceService.getAccountBalanceItems({filters,userId,userCurrency- });-- const { activities } =- await this.orderService.getOrdersForPortfolioCalculator({+ }),+ this.orderService.getOrdersForPortfolioCalculator({filters,userCurrency,userId- });+ })+ ]);if (accountBalanceItems.length === 0 && activities.length === 0) {return {