Feature/align holdings and regions of public page with allocations page (#3815)

* Align holdings and regions of public page with allocations page

* Update changelog
pull/3813/head^2
Thomas Kaul 2 months ago committed by GitHub
parent e301dc5612
commit 4a97e2bb54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the usability of various action menus by introducing horizontal lines to separate the delete action
- Aligned the holdings and regions of the public page with the allocations page
- Considered the users language in the link of the access table to share the portfolio
- Improved the language localization for German (`de`)

@ -63,7 +63,6 @@ export class PublicController {
{ performance: performanceYtd }
] = await Promise.all([
this.portfolioService.getDetails({
filters: [{ id: 'EQUITY', type: 'ASSET_CLASS' }],
impersonationId: access.userId,
userId: user.id,
withMarkets: true
@ -114,6 +113,7 @@ export class PublicController {
publicPortfolioResponse.holdings[symbol] = {
allocationInPercentage:
portfolioPosition.valueInBaseCurrency / totalValue,
assetClass: hasDetails ? portfolioPosition.assetClass : undefined,
countries: hasDetails ? portfolioPosition.countries : [],
currency: hasDetails ? portfolioPosition.currency : undefined,
dataSource: portfolioPosition.dataSource,

@ -9,6 +9,7 @@ import { Market } from '@ghostfolio/common/types';
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AssetClass } from '@prisma/client';
import { StatusCodes } from 'http-status-codes';
import { isNumber } from 'lodash';
import { DeviceDetectorService } from 'ngx-device-detector';
@ -145,6 +146,9 @@ export class PublicPageComponent implements OnInit {
value: position.allocationInPercentage
};
if (position.assetClass !== AssetClass.LIQUIDITY) {
// Prepare analysis data by continents, countries, holdings and sectors except for liquidity
if (position.countries.length > 0) {
this.markets.developedMarkets.value +=
position.markets.developedMarkets * position.valueInBaseCurrency;
@ -164,18 +168,21 @@ export class PublicPageComponent implements OnInit {
name: continent,
value:
weight *
this.publicPortfolioDetails.holdings[symbol].valueInBaseCurrency
this.publicPortfolioDetails.holdings[symbol]
.valueInBaseCurrency
};
}
if (this.countries[code]?.value) {
this.countries[code].value += weight * position.valueInBaseCurrency;
this.countries[code].value +=
weight * position.valueInBaseCurrency;
} else {
this.countries[code] = {
name,
value:
weight *
this.publicPortfolioDetails.holdings[symbol].valueInBaseCurrency
this.publicPortfolioDetails.holdings[symbol]
.valueInBaseCurrency
};
}
}
@ -201,7 +208,8 @@ export class PublicPageComponent implements OnInit {
name,
value:
weight *
this.publicPortfolioDetails.holdings[symbol].valueInBaseCurrency
this.publicPortfolioDetails.holdings[symbol]
.valueInBaseCurrency
};
}
}
@ -209,6 +217,7 @@ export class PublicPageComponent implements OnInit {
this.sectors[UNKNOWN_KEY].value +=
this.publicPortfolioDetails.holdings[symbol].valueInBaseCurrency;
}
}
this.symbols[prettifySymbol(symbol)] = {
name: position.name,

@ -7,6 +7,7 @@ export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 {
[symbol: string]: Pick<
PortfolioPosition,
| 'allocationInPercentage'
| 'assetClass'
| 'countries'
| 'currency'
| 'dataSource'

Loading…
Cancel
Save