Browse Source

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

* Introduce Promise.all()

* Update changelog
pull/4382/head^2
Thomas Kaul 4 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 ### 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 - Improved the symbol lookup in the _Trackinsight_ data enhancer for asset profile data
### Fixed ### 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 user = await this.userService.user({ id: userId });
const userCurrency = this.getUserCurrency(user); const userCurrency = this.getUserCurrency(user);
const accountBalanceItems = const [accountBalanceItems, { activities }] = await Promise.all([
await this.accountBalanceService.getAccountBalanceItems({ this.accountBalanceService.getAccountBalanceItems({
filters, filters,
userId, userId,
userCurrency userCurrency
}); }),
this.orderService.getOrdersForPortfolioCalculator({
const { activities } =
await this.orderService.getOrdersForPortfolioCalculator({
filters, filters,
userCurrency, userCurrency,
userId userId
}); })
]);
if (accountBalanceItems.length === 0 && activities.length === 0) { if (accountBalanceItems.length === 0 && activities.length === 0) {
return { return {

Loading…
Cancel
Save