Germán Martín 2 weeks ago
committed by GitHub
parent
commit
d2d3ff1479
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 1
      apps/api/src/app/endpoints/public/public.controller.ts
  3. 2
      apps/api/src/app/portfolio/portfolio.service.ts
  4. 1
      libs/common/src/lib/interfaces/portfolio-position.interface.ts
  5. 1
      libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts
  6. 27
      libs/ui/src/lib/holdings-table/holdings-table.component.html
  7. 2
      libs/ui/src/lib/holdings-table/holdings-table.component.ts

4
CHANGELOG.md

@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Extended the content of the pricing page
- Added a _Storybook_ story for the holdings table component
### Added
- Add Average Buy Price in holdings table
### Changed
- Disabled the zoom functionality in the _Progressive Web App_ (PWA)

1
apps/api/src/app/endpoints/public/public.controller.ts

@ -168,6 +168,7 @@ export class PublicController {
allocationInPercentage:
portfolioPosition.valueInBaseCurrency / totalValue,
assetClass: hasDetails ? portfolioPosition.assetClass : undefined,
averagePrice: hasDetails ? portfolioPosition.averagePrice : undefined,
countries: hasDetails ? portfolioPosition.countries : [],
currency: hasDetails ? portfolioPosition.currency : undefined,
dataSource: portfolioPosition.dataSource,

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

@ -569,6 +569,7 @@ export class PortfolioService {
}
for (const {
averagePrice,
currency,
dividend,
firstBuyDate,
@ -624,6 +625,7 @@ export class PortfolioService {
: valueInBaseCurrency.div(filteredValueInBaseCurrency).toNumber(),
assetClass: assetProfile.assetClass,
assetSubClass: assetProfile.assetSubClass,
averagePrice: averagePrice?.toNumber(),
countries: assetProfile.countries,
dataSource: assetProfile.dataSource,
dateOfFirstActivity: parseDate(firstBuyDate),

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

@ -12,6 +12,7 @@ export interface PortfolioPosition {
assetClassLabel?: string;
assetSubClass?: AssetSubClass;
assetSubClassLabel?: string;
averagePrice?: number;
countries: Country[];
currency: string;
dataSource: DataSource;

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

@ -15,6 +15,7 @@ export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 {
PortfolioPosition,
| 'allocationInPercentage'
| 'assetClass'
| 'averagePrice'
| 'countries'
| 'currency'
| 'dataSource'

27
libs/ui/src/lib/holdings-table/holdings-table.component.html

@ -88,6 +88,33 @@
</td>
</ng-container>
<ng-container matColumnDef="averagePrice">
<th
*matHeaderCellDef
class="d-none d-lg-table-cell justify-content-end px-1"
mat-header-cell
mat-sort-header
>
<ng-container i18n>Avg. Buy Price</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
[isCurrency]="
element.averagePrice !== null &&
element.averagePrice !== undefined
"
[locale]="locale"
[value]="isLoading ? undefined : (element.averagePrice ?? '')"
/>
</div>
</td>
</ng-container>
<ng-container matColumnDef="valueInBaseCurrency">
<th
*matHeaderCellDef

2
libs/ui/src/lib/holdings-table/holdings-table.component.ts

@ -76,6 +76,8 @@ export class GfHoldingsTableComponent implements OnChanges, OnDestroy {
this.displayedColumns.push('quantity');
}
this.displayedColumns.push('averagePrice');
if (this.hasPermissionToShowValues) {
this.displayedColumns.push('valueInBaseCurrency');
}

Loading…
Cancel
Save