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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
19 additions and
9 deletions
-
CHANGELOG.md
-
apps/client/src/app/components/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
-
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
-
apps/client/src/app/pages/portfolio/allocations/allocations-page.html
|
|
@ -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 |
|
|
|
|
|
@ -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; |
|
|
|
|
|
@ -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 |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -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> |
|
|
|