Browse Source
Merge branch 'main' into feature/include-unavailable-data-in-allocations-by-market-chart
pull/2190/head
Thomas Kaul
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
20 additions and
14 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio.service.ts
-
libs/ui/src/lib/activities-table/activities-table.component.ts
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Extended the allocations by market chart on the allocations page by unavailable data |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Considered liabilities in the total account value calculation |
|
|
|
|
|
|
|
## 1.293.0 - 2023-07-26 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -1842,12 +1842,12 @@ export class PortfolioService { |
|
|
|
userId: string; |
|
|
|
withExcludedAccounts?: boolean; |
|
|
|
}) { |
|
|
|
const ordersOfTypeItem = await this.orderService.getOrders({ |
|
|
|
const ordersOfTypeItemOrLiability = await this.orderService.getOrders({ |
|
|
|
filters, |
|
|
|
userCurrency, |
|
|
|
userId, |
|
|
|
withExcludedAccounts, |
|
|
|
types: ['ITEM'] |
|
|
|
types: ['ITEM', 'LIABILITY'] |
|
|
|
}); |
|
|
|
|
|
|
|
const accounts: PortfolioDetails['accounts'] = {}; |
|
|
@ -1887,13 +1887,14 @@ export class PortfolioService { |
|
|
|
return accountId === account.id; |
|
|
|
}); |
|
|
|
|
|
|
|
const ordersOfTypeItemByAccount = ordersOfTypeItem.filter( |
|
|
|
({ accountId }) => { |
|
|
|
const ordersOfTypeItemOrLiabilityByAccount = |
|
|
|
ordersOfTypeItemOrLiability.filter(({ accountId }) => { |
|
|
|
return accountId === account.id; |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
ordersByAccount = ordersByAccount.concat(ordersOfTypeItemByAccount); |
|
|
|
ordersByAccount = ordersByAccount.concat( |
|
|
|
ordersOfTypeItemOrLiabilityByAccount |
|
|
|
); |
|
|
|
|
|
|
|
accounts[account.id] = { |
|
|
|
balance: account.balance, |
|
|
@ -1933,7 +1934,7 @@ export class PortfolioService { |
|
|
|
order.unitPrice ?? |
|
|
|
0); |
|
|
|
|
|
|
|
if (order.type === 'SELL') { |
|
|
|
if (order.type === 'LIABILITY' || order.type === 'SELL') { |
|
|
|
currentValueOfSymbolInBaseCurrency *= -1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -383,13 +383,14 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
private getTotalValue() { |
|
|
|
let totalValue = new Big(0); |
|
|
|
const paginatedData = this.getPaginatedData(); |
|
|
|
for (const activity of paginatedData) { |
|
|
|
if (isNumber(activity.valueInBaseCurrency)) { |
|
|
|
if (activity.type === 'BUY' || activity.type === 'ITEM') { |
|
|
|
totalValue = totalValue.plus(activity.valueInBaseCurrency); |
|
|
|
} else if (activity.type === 'SELL') { |
|
|
|
let totalValue = new Big(0); |
|
|
|
|
|
|
|
for (const { type, valueInBaseCurrency } of paginatedData) { |
|
|
|
if (isNumber(valueInBaseCurrency)) { |
|
|
|
if (type === 'BUY' || type === 'ITEM') { |
|
|
|
totalValue = totalValue.plus(valueInBaseCurrency); |
|
|
|
} else if (type === 'LIABILITY' || type === 'SELL') { |
|
|
|
return null; |
|
|
|
} |
|
|
|
} else { |
|
|
|