Feature/break down performance into asset and currency (#2863)
* Break down performance into asset and currency * Nullify values * Update changelog
This commit is contained in:
parent
be801b481e
commit
5fa3388609
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Broken down the performance into asset and currency on the analysis page (experimental)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Prepared the portfolio calculation for exchange rate effects
|
- Prepared the portfolio calculation for exchange rate effects
|
||||||
|
@ -155,7 +155,9 @@ export class PortfolioController {
|
|||||||
'cash',
|
'cash',
|
||||||
'committedFunds',
|
'committedFunds',
|
||||||
'currentGrossPerformance',
|
'currentGrossPerformance',
|
||||||
|
'currentGrossPerformanceWithCurrencyEffect',
|
||||||
'currentNetPerformance',
|
'currentNetPerformance',
|
||||||
|
'currentNetPerformanceWithCurrencyEffect',
|
||||||
'currentValue',
|
'currentValue',
|
||||||
'dividend',
|
'dividend',
|
||||||
'emergencyFund',
|
'emergencyFund',
|
||||||
@ -383,7 +385,9 @@ export class PortfolioController {
|
|||||||
performanceInformation.performance,
|
performanceInformation.performance,
|
||||||
[
|
[
|
||||||
'currentGrossPerformance',
|
'currentGrossPerformance',
|
||||||
|
'currentGrossPerformanceWithCurrencyEffect',
|
||||||
'currentNetPerformance',
|
'currentNetPerformance',
|
||||||
|
'currentNetPerformanceWithCurrencyEffect',
|
||||||
'currentNetWorth',
|
'currentNetWorth',
|
||||||
'currentValue',
|
'currentValue',
|
||||||
'totalInvestment'
|
'totalInvestment'
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
Filter,
|
Filter,
|
||||||
HistoricalDataItem,
|
HistoricalDataItem,
|
||||||
PortfolioInvestments,
|
PortfolioInvestments,
|
||||||
|
PortfolioPerformance,
|
||||||
Position,
|
Position,
|
||||||
User
|
User
|
||||||
} from '@ghostfolio/common/interfaces';
|
} from '@ghostfolio/common/interfaces';
|
||||||
@ -54,6 +55,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
|
|||||||
{ label: $localize`Monthly`, value: 'month' },
|
{ label: $localize`Monthly`, value: 'month' },
|
||||||
{ label: $localize`Yearly`, value: 'year' }
|
{ label: $localize`Yearly`, value: 'year' }
|
||||||
];
|
];
|
||||||
|
public performance: PortfolioPerformance;
|
||||||
public performanceDataItems: HistoricalDataItem[];
|
public performanceDataItems: HistoricalDataItem[];
|
||||||
public performanceDataItemsInPercentage: HistoricalDataItem[];
|
public performanceDataItemsInPercentage: HistoricalDataItem[];
|
||||||
public placeholder = '';
|
public placeholder = '';
|
||||||
@ -326,11 +328,12 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
|
|||||||
range: this.user?.settings?.dateRange
|
range: this.user?.settings?.dateRange
|
||||||
})
|
})
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe(({ chart, firstOrderDate }) => {
|
.subscribe(({ chart, firstOrderDate, performance }) => {
|
||||||
this.firstOrderDate = firstOrderDate ?? new Date();
|
this.firstOrderDate = firstOrderDate ?? new Date();
|
||||||
this.daysInMarket = differenceInDays(new Date(), firstOrderDate);
|
this.daysInMarket = differenceInDays(new Date(), firstOrderDate);
|
||||||
|
|
||||||
this.investments = [];
|
this.investments = [];
|
||||||
|
this.performance = performance;
|
||||||
this.performanceDataItems = [];
|
this.performanceDataItems = [];
|
||||||
this.performanceDataItemsInPercentage = [];
|
this.performanceDataItemsInPercentage = [];
|
||||||
|
|
||||||
|
@ -34,6 +34,108 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (user?.settings?.isExperimentalFeatures) {
|
||||||
|
<div class="mb-5 row">
|
||||||
|
<div class="col">
|
||||||
|
<mat-card appearance="outlined" class="mb-3">
|
||||||
|
<mat-card-content>
|
||||||
|
<div class="d-flex py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Absolute Asset Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[isCurrency]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[unit]="user?.settings?.baseCurrency"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : performance?.currentNetPerformance"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex mb-3 ml-3 py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Asset Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[colorizeSign]="true"
|
||||||
|
[isPercent]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : performance?.currentNetPerformancePercent"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Absolute Currency Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[isCurrency]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[unit]="user?.settings?.baseCurrency"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : (performance?.currentNetPerformanceWithCurrencyEffect === null ? null : performance?.currentNetPerformanceWithCurrencyEffect - performance?.currentNetPerformance)"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex ml-3 py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Currency Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[colorizeSign]="true"
|
||||||
|
[isPercent]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : performance?.currentNetPerformancePercentWithCurrencyEffect - performance?.currentNetPerformancePercent"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div><hr /></div>
|
||||||
|
<div class="d-flex py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Absolute Net Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[isCurrency]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[unit]="user?.settings?.baseCurrency"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : performance?.currentNetPerformanceWithCurrencyEffect"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex ml-3 py-1">
|
||||||
|
<div class="flex-grow-1 mr-2 text-truncate" i18n>
|
||||||
|
Net Performance
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<gf-value
|
||||||
|
class="justify-content-end"
|
||||||
|
position="end"
|
||||||
|
[colorizeSign]="true"
|
||||||
|
[isPercent]="true"
|
||||||
|
[locale]="user?.settings?.locale"
|
||||||
|
[value]="isLoadingInvestmentChart ? undefined : performance?.currentNetPerformancePercentWithCurrencyEffect"
|
||||||
|
></gf-value>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="mb-5 row">
|
<div class="mb-5 row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<mat-card appearance="outlined" class="mb-3">
|
<mat-card appearance="outlined" class="mb-3">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user