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
parent
commit
2b8a7de950
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 11
      apps/api/src/app/portfolio/portfolio.service.ts

1
CHANGELOG.md

@ -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 - 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 dynamic numerical precision for various values in the account detail dialog
- Improved the usability of the _Cancel_ / _Close_ and _Save_ buttons in various dialogs - 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 - Extended the accounts endpoint by dividend and interest
- Refactored the portfolio performance component to standalone - Refactored the portfolio performance component to standalone
- Improved the language localization for Portuguese (`pt`) - Improved the language localization for Portuguese (`pt`)

11
apps/api/src/app/portfolio/portfolio.service.ts

@ -227,7 +227,7 @@ export class PortfolioService {
interestInBaseCurrency, interestInBaseCurrency,
transactionCount, transactionCount,
valueInBaseCurrency, valueInBaseCurrency,
allocationInPercentage: null, // TODO allocationInPercentage: 0,
balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( balanceInBaseCurrency: this.exchangeRateDataService.toCurrency(
account.balance, account.balance,
account.currency, account.currency,
@ -299,6 +299,15 @@ export class PortfolioService {
transactionCount += account.transactionCount; transactionCount += account.transactionCount;
} }
for (const account of accounts) {
account.allocationInPercentage =
totalValueInBaseCurrency.toNumber() > Number.EPSILON
? Big(account.valueInBaseCurrency)
.div(totalValueInBaseCurrency)
.toNumber()
: 0;
}
return { return {
accounts, accounts,
transactionCount, transactionCount,

Loading…
Cancel
Save