Feature/rename share to allocation in columns of positions table (#93)

* Rename columns

* Initial Share -> Initial Allocation
* Current Share -> Current Allocation

* Update changelog
pull/94/head
Thomas 3 years ago committed by GitHub
parent b0a24e4fc0
commit 111d8d8e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactored the active menu item state by parsing the current url
- Used a desaturated background color for unknown types in pie charts
- Renamed the columns _Initial Share_ and _Current Share_ to _Initial Allocation_ and _Current Allocation_ in the positions table
### Fixed

@ -5,6 +5,8 @@ export interface PortfolioPosition {
accounts: {
[name: string]: { current: number; original: number };
};
allocationCurrent: number;
allocationInvestment: number;
currency: Currency;
exchange?: string;
grossPerformance: number;
@ -18,8 +20,6 @@ export interface PortfolioPosition {
name: string;
quantity: number;
sector?: string;
shareCurrent: number;
shareInvestment: number;
transactionCount: number;
symbol: string;
type?: string;

@ -188,6 +188,8 @@ describe('Portfolio', () => {
)
}
},
// allocationCurrent: 0.9999999559148652,
allocationInvestment: 1,
currency: Currency.USD,
exchange: UNKNOWN_KEY,
grossPerformance: 0,
@ -201,8 +203,6 @@ describe('Portfolio', () => {
marketState: MarketState.open,
name: 'Bitcoin USD',
quantity: 1,
// shareCurrent: 0.9999999559148652,
shareInvestment: 1,
symbol: 'BTCUSD',
transactionCount: 1,
type: 'Cryptocurrency'
@ -289,6 +289,8 @@ describe('Portfolio', () => {
)
}
},
// allocationCurrent: 1,
allocationInvestment: 1,
currency: Currency.USD,
exchange: UNKNOWN_KEY,
// grossPerformance: 0,
@ -301,8 +303,6 @@ describe('Portfolio', () => {
// marketPrice: 57973.008,
name: 'Ethereum USD',
quantity: 0.2,
// shareCurrent: 1,
shareInvestment: 1,
transactionCount: 1,
symbol: 'ETHUSD',
type: 'Cryptocurrency'

@ -39,6 +39,7 @@ import { IOrder } from '../services/interfaces/interfaces';
import { RulesService } from '../services/rules.service';
import { PortfolioInterface } from './interfaces/portfolio.interface';
import { Order } from './order';
import { OrderType } from './order-type';
import { AccountClusterRiskCurrentInvestment } from './rules/account-cluster-risk/current-investment';
import { AccountClusterRiskInitialInvestment } from './rules/account-cluster-risk/initial-investment';
import { AccountClusterRiskSingleAccount } from './rules/account-cluster-risk/single-account';
@ -285,6 +286,14 @@ export class Portfolio implements PortfolioInterface {
...data[symbol],
accounts,
symbol,
allocationCurrent:
this.exchangeRateDataService.toCurrency(
portfolioItem.positions[symbol].quantity * now,
data[symbol]?.currency,
this.user.Settings.currency
) / value,
allocationInvestment:
portfolioItem.positions[symbol].investment / investment,
grossPerformance: roundTo(
portfolioItemsNow.positions[symbol].quantity * (now - before),
2
@ -292,14 +301,6 @@ export class Portfolio implements PortfolioInterface {
grossPerformancePercent: roundTo((now - before) / before, 4),
investment: portfolioItem.positions[symbol].investment,
quantity: portfolioItem.positions[symbol].quantity,
shareCurrent:
this.exchangeRateDataService.toCurrency(
portfolioItem.positions[symbol].quantity * now,
data[symbol]?.currency,
this.user.Settings.currency
) / value,
shareInvestment:
portfolioItem.positions[symbol].investment / investment,
transactionCount: portfolioItem.positions[symbol].transactionCount
};
});
@ -537,12 +538,12 @@ export class Portfolio implements PortfolioInterface {
this.orders.push(
new Order({
account: order.Account,
currency: <any>order.currency,
currency: order.currency,
date: order.date.toISOString(),
fee: order.fee,
quantity: order.quantity,
symbol: order.symbol,
type: <any>order.type,
type: <OrderType>order.type,
unitPrice: order.unitPrice
})
);

@ -1,7 +1,7 @@
<table
class="gf-table w-100"
matSort
matSortActive="shareCurrent"
matSortActive="allocationCurrent"
matSortDirection="desc"
mat-table
[dataSource]="dataSource"
@ -36,7 +36,7 @@
</td>
</ng-container>
<ng-container matColumnDef="shareInvestment">
<ng-container matColumnDef="allocationInvestment">
<th
*matHeaderCellDef
class="justify-content-end px-1"
@ -44,20 +44,20 @@
mat-header-cell
mat-sort-header
>
Initial Share
Initial Allocation
</th>
<td mat-cell *matCellDef="let element">
<div class="d-flex justify-content-end px-1">
<gf-value
[isPercent]="true"
[locale]="locale"
[value]="isLoading ? undefined : element.shareInvestment"
[value]="isLoading ? undefined : element.allocationInvestment"
></gf-value>
</div>
</td>
</ng-container>
<ng-container matColumnDef="shareCurrent">
<ng-container matColumnDef="allocationCurrent">
<th
*matHeaderCellDef
class="justify-content-end px-1"
@ -65,14 +65,14 @@
mat-header-cell
mat-sort-header
>
Current Share
Current Allocation
</th>
<td *matCellDef="let element" class="px-1" mat-cell>
<div class="d-flex justify-content-end">
<gf-value
[isPercent]="true"
[locale]="locale"
[value]="isLoading ? undefined : element.shareCurrent"
[value]="isLoading ? undefined : element.allocationCurrent"
></gf-value>
</div>
</td>

@ -73,8 +73,8 @@ export class PositionsTableComponent implements OnChanges, OnInit {
this.displayedColumns = [
'symbol',
'performance',
'shareInvestment',
'shareCurrent'
'allocationInvestment',
'allocationCurrent'
];
this.isLoading = true;

@ -108,8 +108,8 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
type: position.type,
value:
aPeriod === 'original'
? position.shareInvestment
: position.shareCurrent
? position.allocationInvestment
: position.allocationCurrent
};
this.positionsArray.push(position);

Loading…
Cancel
Save