Browse Source

Merge pull request #1 from ghostfolio/feature/improve-allocation-by-symbol

Feature/improve allocation by symbol
pull/326/head
Ivo Valchev 4 years ago
committed by GitHub
parent
commit
d5445bd323
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 3
      apps/client/src/app/components/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
  3. 16
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  4. 3
      apps/client/src/app/pages/portfolio/allocations/allocations-page.html

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Added the allocation chart by symbol
## 1.44.0 - 30.08.2021
### Changed

3
apps/client/src/app/components/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -167,7 +167,8 @@ export class PortfolioProportionChartComponent
// Reuse color
item.color = this.colorMap[symbol];
} else {
const color = this.getColorPalette()[index];
const color =
this.getColorPalette()[index % this.getColorPalette().length];
// Store color for reuse
this.colorMap[symbol] = color;

16
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -49,6 +49,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
public user: User;
private unsubscribeSubject = new Subject<void>();
/**
* @constructor
*/
@ -148,12 +149,6 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
};
this.positionsArray.push(position);
if (this.symbols[symbol] === undefined) {
this.symbols[symbol] = { name: symbol, value: position.value };
} else {
this.symbols[symbol].value += position.value;
}
if (position.assetClass !== AssetClass.CASH) {
// Prepare analysis data by continents, countries and sectors except for cash
@ -223,6 +218,15 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
: this.portfolioDetails.holdings[symbol].value;
}
}
if (position.assetSubClass !== AssetClass.CASH) {
// Prepare analysis data by symbols except for cash
this.symbols[symbol] = {
name: symbol,
value: aPeriod === 'original' ? position.investment : position.value
};
}
}
}

3
apps/client/src/app/pages/portfolio/allocations/allocations-page.html

@ -19,10 +19,9 @@
<mat-card-content>
<gf-portfolio-proportion-chart
[baseCurrency]="user?.settings?.baseCurrency"
[isInPercent]="hasImpersonationId"
[isInPercent]="false"
[keys]="['name']"
[locale]="user?.settings?.locale"
[maxItems]="10"
[positions]="symbols"
></gf-portfolio-proportion-chart>
</mat-card-content>

Loading…
Cancel
Save