Browse Source

Implement ROI portfolio calculator

Thomas Kaul 2 weeks ago
parent
commit
062121eb1c
  1. 10
      apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html
  2. 4
      apps/client/src/app/components/user-account-settings/user-account-settings.html
  3. 10
      apps/client/src/app/pages/portfolio/analysis/analysis-page.html
  4. 5
      libs/common/src/lib/dtos/update-user-setting.dto.ts

10
apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html

@ -159,6 +159,16 @@
title="Return on Average Investment (total return with dividends)"
>(ROAI)</abbr
>
} @else if (
user?.settings?.performanceCalculationType ===
PerformanceCalculationType.ROI
) {
<abbr
class="d-none d-sm-inline-block initialism ml-2 text-muted"
i18n-title
title="Return on Investment (total return with dividends)"
>(ROI)</abbr
>
}
</div>
<div class="flex-column flex-wrap justify-content-end">

4
apps/client/src/app/components/user-account-settings/user-account-settings.html

@ -39,7 +39,6 @@
<mat-form-field appearance="outline" class="w-100 without-hint">
<mat-select
name="performanceCalculationType"
[disabled]="true"
[value]="user.settings.performanceCalculationType"
(selectionChange)="
onChangeUserSetting(
@ -51,6 +50,9 @@
<mat-option value="ROAI"
>Return on Average Investment (ROAI)</mat-option
>
<mat-option value="ROI"
>Return on Investment (ROI)</mat-option
>
</mat-select>
</mat-form-field>
</div>

10
apps/client/src/app/pages/portfolio/analysis/analysis-page.html

@ -264,6 +264,16 @@
title="Return on Average Investment (total return with dividends)"
>(ROAI)</abbr
>
} @else if (
user?.settings?.performanceCalculationType ===
PerformanceCalculationType.ROI
) {
<abbr
class="d-none d-sm-inline-block initialism ml-2 text-muted"
i18n-title
title="Return on Investment (total return with dividends)"
>(ROI)</abbr
>
}
</div>
<div class="d-flex justify-content-end">

5
libs/common/src/lib/dtos/update-user-setting.dto.ts

@ -5,6 +5,7 @@ import type {
HoldingsViewMode,
ViewMode
} from '@ghostfolio/common/types';
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type';
import { IsCurrencyCode } from '@ghostfolio/common/validators/is-currency-code';
import {
@ -96,6 +97,10 @@ export class UpdateUserSettingDto {
@IsOptional()
locale?: string;
@IsIn([PerformanceCalculationType.ROAI, PerformanceCalculationType.ROI])
@IsOptional()
performanceCalculationType?: PerformanceCalculationType;
/**
* The target financial amount the user aims to reach before retiring.
* Can be explicitly set to null to clear the value and calculate it dynamically.

Loading…
Cancel
Save