Feature/replace type with asset class (#274)
* Improved the asset classification * Add assetClass to symbolProfile * Remove type from position * Update changelog
This commit is contained in:
@@ -10,4 +10,4 @@ import { PortfolioProportionChartComponent } from './portfolio-proportion-chart.
|
||||
imports: [CommonModule, NgxSkeletonLoaderModule],
|
||||
providers: []
|
||||
})
|
||||
export class PortfolioProportionChartModule {}
|
||||
export class GfPortfolioProportionChartModule {}
|
||||
|
@@ -83,10 +83,10 @@
|
||||
*matRowDef="let row; columns: displayedColumns"
|
||||
mat-row
|
||||
[ngClass]="{
|
||||
'cursor-pointer': !this.ignoreTypes.includes(row.type)
|
||||
'cursor-pointer': !this.ignoreAssetClasses.includes(row.assetClass)
|
||||
}"
|
||||
(click)="
|
||||
!this.ignoreTypes.includes(row.type) &&
|
||||
!this.ignoreAssetClasses.includes(row.assetClass) &&
|
||||
onOpenPositionDialog({ symbol: row.symbol, title: row.name })
|
||||
"
|
||||
></tr>
|
||||
|
@@ -14,9 +14,8 @@ import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Type } from '@ghostfolio/api/services/interfaces/interfaces';
|
||||
import { PortfolioPosition } from '@ghostfolio/common/interfaces';
|
||||
import { Order as OrderModel } from '@prisma/client';
|
||||
import { AssetClass, Order as OrderModel } from '@prisma/client';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -43,7 +42,7 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
|
||||
public dataSource: MatTableDataSource<PortfolioPosition> =
|
||||
new MatTableDataSource();
|
||||
public displayedColumns = [];
|
||||
public ignoreTypes = [Type.Cash];
|
||||
public ignoreAssetClasses = [AssetClass.CASH.toString()];
|
||||
public isLoading = true;
|
||||
public pageSize = 7;
|
||||
public routeQueryParams: Subscription;
|
||||
|
@@ -5,11 +5,9 @@ import {
|
||||
OnChanges,
|
||||
OnInit
|
||||
} from '@angular/core';
|
||||
import {
|
||||
MarketState,
|
||||
Type
|
||||
} from '@ghostfolio/api/services/interfaces/interfaces';
|
||||
import { MarketState } from '@ghostfolio/api/services/interfaces/interfaces';
|
||||
import { Position } from '@ghostfolio/common/interfaces';
|
||||
import { AssetClass } from '@prisma/client';
|
||||
|
||||
@Component({
|
||||
selector: 'gf-positions',
|
||||
@@ -28,7 +26,7 @@ export class PositionsComponent implements OnChanges, OnInit {
|
||||
public positionsRest: Position[] = [];
|
||||
public positionsWithPriority: Position[] = [];
|
||||
|
||||
private ignoreTypes = [Type.Cash];
|
||||
private ignoreAssetClasses = [AssetClass.CASH.toString()];
|
||||
|
||||
public constructor() {}
|
||||
|
||||
@@ -46,7 +44,7 @@ export class PositionsComponent implements OnChanges, OnInit {
|
||||
this.positionsWithPriority = [];
|
||||
|
||||
for (const portfolioPosition of this.positions) {
|
||||
if (this.ignoreTypes.includes(portfolioPosition.type)) {
|
||||
if (this.ignoreAssetClasses.includes(portfolioPosition.assetClass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -116,9 +116,9 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
||||
|
||||
for (const [symbol, position] of Object.entries(aPortfolioPositions)) {
|
||||
this.positions[symbol] = {
|
||||
assetClass: position.assetClass,
|
||||
currency: position.currency,
|
||||
exchange: position.exchange,
|
||||
type: position.type,
|
||||
value:
|
||||
aPeriod === 'original'
|
||||
? position.allocationInvestment
|
||||
|
@@ -12,28 +12,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="proportion-charts row">
|
||||
<div class="col-md-6">
|
||||
<mat-card class="mb-3">
|
||||
<mat-card-header class="w-100">
|
||||
<mat-card-title i18n>By Type</mat-card-title>
|
||||
<gf-toggle
|
||||
[defaultValue]="period"
|
||||
[isLoading]="false"
|
||||
[options]="periodOptions"
|
||||
(change)="onChangePeriod($event.value)"
|
||||
></gf-toggle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<gf-portfolio-proportion-chart
|
||||
key="type"
|
||||
[baseCurrency]="user?.settings?.baseCurrency"
|
||||
[isInPercent]="true"
|
||||
[locale]="user?.settings?.locale"
|
||||
[positions]="positions"
|
||||
></gf-portfolio-proportion-chart>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<mat-card class="mb-3">
|
||||
<mat-card-header class="w-100">
|
||||
@@ -59,7 +37,7 @@
|
||||
<div class="col-md-6">
|
||||
<mat-card class="mb-3">
|
||||
<mat-card-header class="w-100">
|
||||
<mat-card-title i18n>By Currency</mat-card-title>
|
||||
<mat-card-title i18n>By Asset Class</mat-card-title>
|
||||
<gf-toggle
|
||||
[defaultValue]="period"
|
||||
[isLoading]="false"
|
||||
@@ -69,7 +47,7 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<gf-portfolio-proportion-chart
|
||||
key="currency"
|
||||
key="assetClass"
|
||||
[baseCurrency]="user?.settings?.baseCurrency"
|
||||
[isInPercent]="true"
|
||||
[locale]="user?.settings?.locale"
|
||||
@@ -81,7 +59,7 @@
|
||||
<div class="col-md-6">
|
||||
<mat-card class="mb-3">
|
||||
<mat-card-header class="w-100">
|
||||
<mat-card-title i18n>By Exchange</mat-card-title>
|
||||
<mat-card-title i18n>By Currency</mat-card-title>
|
||||
<gf-toggle
|
||||
[defaultValue]="period"
|
||||
[isLoading]="false"
|
||||
@@ -91,7 +69,7 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<gf-portfolio-proportion-chart
|
||||
key="exchange"
|
||||
key="currency"
|
||||
[baseCurrency]="user?.settings?.baseCurrency"
|
||||
[isInPercent]="true"
|
||||
[locale]="user?.settings?.locale"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { PortfolioProportionChartModule } from '@ghostfolio/client/components/portfolio-proportion-chart/portfolio-proportion-chart.module';
|
||||
import { GfPortfolioProportionChartModule } from '@ghostfolio/client/components/portfolio-proportion-chart/portfolio-proportion-chart.module';
|
||||
import { GfPositionsTableModule } from '@ghostfolio/client/components/positions-table/positions-table.module';
|
||||
import { GfToggleModule } from '@ghostfolio/client/components/toggle/toggle.module';
|
||||
import { GfWorldMapChartModule } from '@ghostfolio/client/components/world-map-chart/world-map-chart.module';
|
||||
@@ -15,11 +15,11 @@ import { AllocationsPageComponent } from './allocations-page.component';
|
||||
imports: [
|
||||
AllocationsPageRoutingModule,
|
||||
CommonModule,
|
||||
GfPortfolioProportionChartModule,
|
||||
GfPositionsTableModule,
|
||||
GfToggleModule,
|
||||
GfWorldMapChartModule,
|
||||
MatCardModule,
|
||||
PortfolioProportionChartModule
|
||||
MatCardModule
|
||||
],
|
||||
providers: [],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
|
Reference in New Issue
Block a user