Browse Source
Feature/extend accounts endpoint by allocations (#5358)
* Extend accounts endpoint by allocations
* Update changelog
pull/5366/head
Attila Cseh
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
1 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio.service.ts
|
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
- Moved the chart of the account detail dialog from experimental to general availability |
|
|
|
- Improved the dynamic numerical precision for various values in the account detail dialog |
|
|
|
- Improved the usability of the _Cancel_ / _Close_ and _Save_ buttons in various dialogs |
|
|
|
- Extended the accounts endpoint by allocations |
|
|
|
- Extended the accounts endpoint by dividend and interest |
|
|
|
- Refactored the portfolio performance component to standalone |
|
|
|
- Improved the language localization for Portuguese (`pt`) |
|
|
|
|
|
@ -227,7 +227,7 @@ export class PortfolioService { |
|
|
|
interestInBaseCurrency, |
|
|
|
transactionCount, |
|
|
|
valueInBaseCurrency, |
|
|
|
allocationInPercentage: null, // TODO
|
|
|
|
allocationInPercentage: 0, |
|
|
|
balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
|
account.balance, |
|
|
|
account.currency, |
|
|
@ -299,6 +299,15 @@ export class PortfolioService { |
|
|
|
transactionCount += account.transactionCount; |
|
|
|
} |
|
|
|
|
|
|
|
for (const account of accounts) { |
|
|
|
account.allocationInPercentage = |
|
|
|
totalValueInBaseCurrency.toNumber() > Number.EPSILON |
|
|
|
? Big(account.valueInBaseCurrency) |
|
|
|
.div(totalValueInBaseCurrency) |
|
|
|
.toNumber() |
|
|
|
: 0; |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
accounts, |
|
|
|
transactionCount, |
|
|
|