Browse Source

Feature/introduce Promise.all() in getPerformance() of portfolio service (#4381)

* Introduce Promise.all()

* Update changelog
pull/4382/head^2
Thomas Kaul 3 weeks ago
committed by GitHub
parent
commit
8b353fbf66
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 13
      apps/api/src/app/portfolio/portfolio.service.ts

1
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
### Fixed

13
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 {

Loading…
Cancel
Save