Browse Source

Add performance timeline

pull/8103/head
Thomas Kaul 6 days ago
parent
commit
e740d2ef7b
  1. 36
      apps/api/src/app/portfolio/portfolio.controller.ts
  2. 6
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

36
apps/api/src/app/portfolio/portfolio.controller.ts

@ -4,7 +4,8 @@ import { Impersonation } from '@ghostfolio/api/decorators/impersonation.decorato
import { RequiresScope } from '@ghostfolio/api/decorators/requires-scope.decorator'; import { RequiresScope } from '@ghostfolio/api/decorators/requires-scope.decorator';
import { import {
hasNotDefinedValuesInObject, hasNotDefinedValuesInObject,
nullifyValuesInObject nullifyValuesInObject,
nullifyValuesInObjects
} from '@ghostfolio/api/helper/object.helper'; } from '@ghostfolio/api/helper/object.helper';
import { convertValuesToPercentages } from '@ghostfolio/api/helper/portfolio.helper'; import { convertValuesToPercentages } from '@ghostfolio/api/helper/portfolio.helper';
import { PerformanceLoggingInterceptor } from '@ghostfolio/api/interceptors/performance-logging/performance-logging.interceptor'; import { PerformanceLoggingInterceptor } from '@ghostfolio/api/interceptors/performance-logging/performance-logging.interceptor';
@ -583,32 +584,27 @@ export class PortfolioController {
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') && this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') &&
this.request.user.subscription?.type === SubscriptionType.Basic this.request.user.subscription?.type === SubscriptionType.Basic
) { ) {
performanceInformation.chart = performanceInformation.chart.map( performanceInformation.chart = nullifyValuesInObjects(
(item) => { performanceInformation.chart,
return nullifyValuesInObject(item, [ [
'dividendInBaseCurrency', 'dividendInBaseCurrency',
'totalInvestment', 'totalInvestment',
'value' 'value',
]); ...(groupBy === 'year'
} ? [
); 'investmentValueWithCurrencyEffect',
performanceInformation.performance = nullifyValuesInObject(
performanceInformation.performance,
['dividendInBaseCurrency', 'netPerformance']
);
if (groupBy === 'year') {
performanceInformation.chart = performanceInformation.chart.map(
(item) => {
return nullifyValuesInObject(item, [
'netPerformance', 'netPerformance',
'netPerformanceInPercentage', 'netPerformanceInPercentage',
'netPerformanceInPercentageWithCurrencyEffect', 'netPerformanceInPercentageWithCurrencyEffect',
'netPerformanceWithCurrencyEffect' 'netPerformanceWithCurrencyEffect'
]); ]
} : [])
]
);
performanceInformation.performance = nullifyValuesInObject(
performanceInformation.performance,
['dividendInBaseCurrency', 'netPerformance']
); );
}
} }
return performanceInformation; return performanceInformation;

6
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -5,6 +5,7 @@ import {
DEFAULT_DATE_RANGE, DEFAULT_DATE_RANGE,
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
import { SubscriptionType } from '@ghostfolio/common/enums';
import { canOpenHoldingDetail } from '@ghostfolio/common/helper'; import { canOpenHoldingDetail } from '@ghostfolio/common/helper';
import { import {
InvestmentItem, InvestmentItem,
@ -454,7 +455,10 @@ export class GfAnalysisPageComponent implements OnInit {
this.fetchDividendsAndInvestments(); this.fetchDividendsAndInvestments();
if (this.user?.settings?.isExperimentalFeatures) { if (
this.user?.settings?.isExperimentalFeatures &&
this.user?.subscription?.type !== SubscriptionType.Basic
) {
this.fetchPerformanceByYear(); this.fetchPerformanceByYear();
} }

Loading…
Cancel
Save