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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
7 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio.service.ts
|
|
@ -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 |
|
|
|
|
|
@ -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 { |
|
|
|