mirror of https://github.com/ghostfolio/ghostfolio
1 changed files with 147 additions and 0 deletions
@ -0,0 +1,147 @@ |
|||||
|
<div class="container"> |
||||
|
<h1 class="d-none d-sm-block h3 mb-3 text-center" i18n>Targets</h1> |
||||
|
|
||||
|
<div class="d-flex justify-content-between align-items-center flex-wrap gap-3 mb-3"> |
||||
|
<div> |
||||
|
@if (profile) { |
||||
|
<div class="fw-bold">{{ profile.name }}</div> |
||||
|
<span class="text-body-secondary small" i18n>Allowed deviation:</span> |
||||
|
<span class="small"> ±{{ profile.tolerance * 100 | number: '1.0-1' }}%</span> |
||||
|
} @else { |
||||
|
<span class="text-body-secondary" i18n>No target configured yet</span> |
||||
|
} |
||||
|
</div> |
||||
|
@if (canEdit) { |
||||
|
<button mat-flat-button [disabled]="isSaving" (click)="openConfiguration()" i18n> |
||||
|
Configure target |
||||
|
</button> |
||||
|
} |
||||
|
</div> |
||||
|
|
||||
|
@if (accounts.length > 1) { |
||||
|
<mat-form-field appearance="outline" class="account-select"> |
||||
|
<mat-label i18n>Account</mat-label> |
||||
|
<mat-select [value]="selectedAccountId" (selectionChange)="changeAccount($event.value)"> |
||||
|
<mat-option value="" i18n>All accounts</mat-option> |
||||
|
@for (account of accounts; track account.id) { |
||||
|
<mat-option [value]="account.id">{{ account.name }}</mat-option> |
||||
|
} |
||||
|
</mat-select> |
||||
|
</mat-form-field> |
||||
|
@if (selectedAccountId) { |
||||
|
<p class="text-body-secondary small" i18n> |
||||
|
Comparing the selected account with the global portfolio target. |
||||
|
</p> |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@if (!profile) { |
||||
|
<mat-card appearance="outlined"> |
||||
|
<mat-card-content> |
||||
|
<p class="mb-0" i18n> |
||||
|
Create a target to compare the actual asset allocation with your desired allocation. |
||||
|
</p> |
||||
|
</mat-card-content> |
||||
|
</mat-card> |
||||
|
} @else if (isLoading) { |
||||
|
<p class="text-body-secondary" i18n>Loading portfolio allocation…</p> |
||||
|
} @else if (hasError || !result || result.status === 'unavailable') { |
||||
|
<mat-card appearance="outlined"> |
||||
|
<mat-card-content> |
||||
|
<p class="mb-0" i18n> |
||||
|
The current allocation cannot be calculated with the available data or permissions. |
||||
|
</p> |
||||
|
</mat-card-content> |
||||
|
</mat-card> |
||||
|
} @else if (result.status === 'empty') { |
||||
|
<p class="text-body-secondary" i18n>The selected portfolio is empty.</p> |
||||
|
} @else if (result.status === 'inconsistent') { |
||||
|
<mat-card appearance="outlined"> |
||||
|
<mat-card-content> |
||||
|
<p class="mb-0" i18n> |
||||
|
The asset classification or account values cannot be reconciled. Check unclassified |
||||
|
holdings, missing market prices, or negative balances before using this comparison. |
||||
|
</p> |
||||
|
</mat-card-content> |
||||
|
</mat-card> |
||||
|
} @else { |
||||
|
<div class="row mb-3"> |
||||
|
<div class="col-md-4 mb-3"> |
||||
|
<mat-card appearance="outlined"><mat-card-content> |
||||
|
<div class="text-body-secondary small" i18n>Total allocation drift</div> |
||||
|
<div class="h3 mb-0">{{ result.totalDrift * 100 | number: '1.0-2' }}%</div> |
||||
|
</mat-card-content></mat-card> |
||||
|
</div> |
||||
|
<div class="col-md-4 mb-3"> |
||||
|
<mat-card appearance="outlined"><mat-card-content> |
||||
|
<div class="text-body-secondary small" i18n>Maximum deviation</div> |
||||
|
<div class="h3 mb-0">{{ result.maxDrift * 100 | number: '1.0-2' }}%</div> |
||||
|
</mat-card-content></mat-card> |
||||
|
</div> |
||||
|
<div class="col-md-4 mb-3"> |
||||
|
<mat-card appearance="outlined"><mat-card-content> |
||||
|
<div class="text-body-secondary small" i18n>Classes outside tolerance</div> |
||||
|
<div class="h3 mb-0">{{ result.outOfToleranceCount }} / {{ displayedRows.length }}</div> |
||||
|
</mat-card-content></mat-card> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<mat-card appearance="outlined" class="mb-3"> |
||||
|
<mat-card-header><mat-card-title i18n>Actual vs target allocation</mat-card-title></mat-card-header> |
||||
|
<mat-card-content class="mt-3"> |
||||
|
<div class="d-flex justify-content-end gap-3 mb-3 small"> |
||||
|
<span><span class="legend-marker current-marker"></span> <ng-container i18n>Actual</ng-container></span> |
||||
|
<span><span class="legend-marker target-marker"></span> <ng-container i18n>Target</ng-container></span> |
||||
|
</div> |
||||
|
@for (row of displayedRows; track row.assetClass) { |
||||
|
<div class="comparison-row mb-3"> |
||||
|
<div class="d-flex justify-content-between mb-1"> |
||||
|
<span>{{ formatClass(row.assetClass) }}</span> |
||||
|
<span [class.text-danger]="row.outOfTolerance"> |
||||
|
{{ (row.drift >= 0 ? '+' : '') + (row.drift * 100 | number: '1.0-2') }}% |
||||
|
</span> |
||||
|
</div> |
||||
|
<div class="comparison-track"> |
||||
|
<div class="comparison-bar current-bar" [style.width.%]="row.actual * 100"></div> |
||||
|
</div> |
||||
|
<div class="comparison-track"> |
||||
|
<div class="comparison-bar target-bar" [style.width.%]="row.target * 100"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
} |
||||
|
</mat-card-content> |
||||
|
</mat-card> |
||||
|
|
||||
|
<mat-card appearance="outlined"> |
||||
|
<mat-card-header><mat-card-title i18n>Deviation details</mat-card-title></mat-card-header> |
||||
|
<mat-card-content class="table-responsive mt-3"> |
||||
|
<table class="table mb-0"> |
||||
|
<thead><tr> |
||||
|
<th i18n>Asset class</th> |
||||
|
<th class="text-end" i18n>Actual</th> |
||||
|
<th class="text-end" i18n>Target</th> |
||||
|
<th class="text-end" i18n>Deviation</th> |
||||
|
<th class="text-end" i18n>Status</th> |
||||
|
</tr></thead> |
||||
|
<tbody> |
||||
|
@for (row of displayedRows; track row.assetClass) { |
||||
|
<tr> |
||||
|
<td>{{ formatClass(row.assetClass) }}</td> |
||||
|
<td class="text-end">{{ row.actual * 100 | number: '1.0-2' }}%</td> |
||||
|
<td class="text-end">{{ row.target * 100 | number: '1.0-2' }}%</td> |
||||
|
<td class="text-end">{{ row.drift * 100 | number: '+1.0-2' }}%</td> |
||||
|
<td class="text-end"> |
||||
|
@if (row.outOfTolerance) { |
||||
|
<span class="text-danger" i18n>Outside tolerance</span> |
||||
|
} @else { |
||||
|
<span class="text-success" i18n>Within tolerance</span> |
||||
|
} |
||||
|
</td> |
||||
|
</tr> |
||||
|
} |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</mat-card-content> |
||||
|
</mat-card> |
||||
|
} |
||||
|
</div> |
||||
Loading…
Reference in new issue