Browse Source

Merge pull request #9 from dandevaud/feature/Stake_displayForm

Added stake precision
pull/5027/head
dandevaud 2 years ago
committed by GitHub
parent
commit
9bc7774988
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
  2. 7
      apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html

9
apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts

@ -55,6 +55,7 @@ export class PositionDetailDialog implements OnDestroy, OnInit {
public orders: OrderWithAccount[]; public orders: OrderWithAccount[];
public quantity: number; public quantity: number;
public quantityPrecision = 2; public quantityPrecision = 2;
public stakePrecision = 2;
public reportDataGlitchMail: string; public reportDataGlitchMail: string;
public sectors: { public sectors: {
[name: string]: { name: string; value: number }; [name: string]: { name: string; value: number };
@ -229,6 +230,13 @@ export class PositionDetailDialog implements OnDestroy, OnInit {
if (Number.isInteger(this.quantity)) { if (Number.isInteger(this.quantity)) {
this.quantityPrecision = 0; this.quantityPrecision = 0;
if (
orders
.filter((o) => o.type === 'STAKE')
.every((o) => Number.isInteger(o.quantity))
) {
this.stakeRewards = 0;
}
} else if (this.SymbolProfile?.assetSubClass === 'CRYPTOCURRENCY') { } else if (this.SymbolProfile?.assetSubClass === 'CRYPTOCURRENCY') {
if (this.quantity < 1) { if (this.quantity < 1) {
this.quantityPrecision = 7; this.quantityPrecision = 7;
@ -237,6 +245,7 @@ export class PositionDetailDialog implements OnDestroy, OnInit {
} else if (this.quantity > 10000000) { } else if (this.quantity > 10000000) {
this.quantityPrecision = 0; this.quantityPrecision = 0;
} }
this.stakePrecision = this.quantityPrecision;
} }
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();

7
apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html

@ -141,12 +141,15 @@
> >
</div> </div>
<div *ngIf="stakeRewards > 0" class="col-6 mb-3"> <div
*ngIf="stakeRewards > 0 && dividendInBaseCurrency == 0"
class="col-6 mb-3"
>
<gf-value <gf-value
i18n i18n
size="medium" size="medium"
[locale]="data.locale" [locale]="data.locale"
[precision]="quantityPrecision" [precision]="stakePrecision"
[value]="stakeRewards" [value]="stakeRewards"
>Stake Rewards >Stake Rewards
</gf-value> </gf-value>

Loading…
Cancel
Save