Browse Source

Feature/add date of first activity to holdings (#1505)

* Add date of first activity

* Update changelog
pull/1507/head
Thomas Kaul 2 years ago
committed by GitHub
parent
commit
49dcade964
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 1
      apps/api/src/app/portfolio/portfolio.controller.ts
  3. 2
      apps/api/src/app/portfolio/portfolio.service.ts
  4. 20
      apps/client/src/app/components/positions-table/positions-table.component.html
  5. 2
      apps/client/src/app/components/positions-table/positions-table.component.ts
  6. 6
      apps/client/src/app/services/data.service.ts
  7. 1
      libs/common/src/lib/interfaces/portfolio-position.interface.ts
  8. 1
      libs/common/src/lib/interfaces/portfolio-public-details.interface.ts

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added the date of the first activity to the positions table
### Changed
- Improved the asset profile details dialog in the admin control panel

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

@ -422,6 +422,7 @@ export class PortfolioController {
allocationCurrent: portfolioPosition.value / totalValue,
countries: hasDetails ? portfolioPosition.countries : [],
currency: hasDetails ? portfolioPosition.currency : undefined,
dateOfFirstActivity: portfolioPosition.dateOfFirstActivity,
markets: hasDetails ? portfolioPosition.markets : undefined,
name: portfolioPosition.name,
netPerformancePercent: portfolioPosition.netPerformancePercent,

2
apps/api/src/app/portfolio/portfolio.service.ts

@ -533,6 +533,7 @@ export class PortfolioService {
countries: symbolProfile.countries,
currency: item.currency,
dataSource: symbolProfile.dataSource,
dateOfFirstActivity: parseDate(item.firstBuyDate),
grossPerformance: item.grossPerformance?.toNumber() ?? 0,
grossPerformancePercent:
item.grossPerformancePercentage?.toNumber() ?? 0,
@ -1329,6 +1330,7 @@ export class PortfolioService {
assetSubClass: AssetClass.CASH,
countries: [],
dataSource: undefined,
dateOfFirstActivity: undefined,
grossPerformance: 0,
grossPerformancePercent: 0,
investment: balance,

20
apps/client/src/app/components/positions-table/positions-table.component.html

@ -42,6 +42,26 @@
</td>
</ng-container>
<ng-container matColumnDef="dateOfFirstActivity">
<th
*matHeaderCellDef
class="d-none d-lg-table-cell justify-content-end px-1"
mat-header-cell
mat-sort-header
>
<ng-container i18n>First Activity</ng-container>
</th>
<td *matCellDef="let element" class="d-none d-lg-table-cell px-1" mat-cell>
<div class="d-flex justify-content-end">
<gf-value
[isDate]="element.dateOfFirstActivity ? true : false"
[locale]="locale"
[value]="element.dateOfFirstActivity ?? ''"
></gf-value>
</div>
</td>
</ng-container>
<ng-container matColumnDef="value">
<th
*matHeaderCellDef

2
apps/client/src/app/components/positions-table/positions-table.component.ts

@ -56,7 +56,7 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
public ngOnInit() {}
public ngOnChanges() {
this.displayedColumns = ['icon', 'symbol', 'name'];
this.displayedColumns = ['icon', 'symbol', 'name', 'dateOfFirstActivity'];
if (this.hasPermissionToShowValues) {
this.displayedColumns.push('value');

6
apps/client/src/app/services/data.service.ts

@ -269,6 +269,12 @@ export class DataService {
response.holdings[symbol].assetSubClass = translate(
response.holdings[symbol].assetSubClass
);
response.holdings[symbol].dateOfFirstActivity = response.holdings[
symbol
].dateOfFirstActivity
? parseISO(response.holdings[symbol].dateOfFirstActivity)
: undefined;
}
}

1
libs/common/src/lib/interfaces/portfolio-position.interface.ts

@ -12,6 +12,7 @@ export interface PortfolioPosition {
countries: Country[];
currency: string;
dataSource: DataSource;
dateOfFirstActivity: Date;
exchange?: string;
grossPerformance: number;
grossPerformancePercent: number;

1
libs/common/src/lib/interfaces/portfolio-public-details.interface.ts

@ -9,6 +9,7 @@ export interface PortfolioPublicDetails {
| 'allocationCurrent'
| 'countries'
| 'currency'
| 'dateOfFirstActivity'
| 'markets'
| 'name'
| 'netPerformancePercent'

Loading…
Cancel
Save