@ -116,6 +116,19 @@ export class GfHoldingDetailDialogComponent implements OnInit {
protected accounts : Account [ ] ;
protected activitiesCount : number ;
protected assetClass : string ;
protected assetProfile : Pick <
EnhancedSymbolProfile ,
| 'assetClass'
| 'assetSubClass'
| 'countries'
| 'currency'
| 'dataSource'
| 'isin'
| 'name'
| 'sectors'
| 'symbol'
| 'userId'
> ;
protected assetSubClass : string ;
protected averagePrice : number ;
protected averagePricePrecision = 2 ;
@ -164,7 +177,6 @@ export class GfHoldingDetailDialogComponent implements OnInit {
} ;
protected sortColumn = 'date' ;
protected sortDirection : SortDirection = 'desc' ;
protected SymbolProfile : EnhancedSymbolProfile ;
protected tagsAvailable : Tag [ ] ;
protected readonly translate = translate ;
protected user : User ;
@ -266,6 +278,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
. subscribe (
( {
activitiesCount ,
assetProfile ,
averagePrice ,
dataProviderInfo ,
dateOfFirstActivity ,
@ -280,11 +293,11 @@ export class GfHoldingDetailDialogComponent implements OnInit {
netPerformancePercentWithCurrencyEffect ,
netPerformanceWithCurrencyEffect ,
quantity ,
SymbolProfile ,
tags ,
value
} ) = > {
this . activitiesCount = activitiesCount ;
this . assetProfile = assetProfile ;
this . averagePrice = averagePrice ;
if (
@ -322,8 +335,8 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this . user ? . permissions ,
permissions . readMarketDataOfOwnAssetProfile
) &&
Symbol Profile? . dataSource === 'MANUAL' &&
Symbol Profile? . userId === this . user ? . id ;
asset Profile? . dataSource === 'MANUAL' &&
asset Profile? . userId === this . user ? . id ;
this . historicalDataItems = historicalData . map (
( { averagePrice , date , marketPrice } ) = > {
@ -402,7 +415,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( Number . isInteger ( this . quantity ) ) {
this . quantityPrecision = 0 ;
} else if ( Symbol Profile? . assetSubClass === 'CRYPTOCURRENCY' ) {
} else if ( asset Profile? . assetSubClass === 'CRYPTOCURRENCY' ) {
if ( this . quantity < 10 ) {
this . quantityPrecision = 8 ;
} else if ( this . quantity < 1000 ) {
@ -413,7 +426,6 @@ export class GfHoldingDetailDialogComponent implements OnInit {
}
this . sectors = { } ;
this . SymbolProfile = SymbolProfile ;
this . tags = tags . map ( ( tag ) = > {
return {
@ -427,21 +439,21 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this . value = value ;
const reportDataGlitchSubject = ` Ghostfolio Data Glitch Report ${
this . Symbol Profile? . symbol ? ` ( ${ this . Symbol Profile. symbol } ) ` : ''
this . asset Profile? . symbol ? ` ( ${ this . asset Profile. symbol } ) ` : ''
} ` ;
this . reportDataGlitchMail = ` mailto:hi@ghostfol.io?Subject= ${ reportDataGlitchSubject } &body=Hello%0D%0DI would like to report a data glitch for%0D%0DSymbol: ${ this . Symbol Profile? . symbol } %0DData Source: ${ this . Symbol Profile? . dataSource } %0D%0DAdditional notes:%0D%0DCan you please take a look?%0D%0DKind regards ` ;
this . reportDataGlitchMail = ` mailto:hi@ghostfol.io?Subject= ${ reportDataGlitchSubject } &body=Hello%0D%0DI would like to report a data glitch for%0D%0DSymbol: ${ this . asset Profile? . symbol } %0DData Source: ${ this . asset Profile? . dataSource } %0D%0DAdditional notes:%0D%0DCan you please take a look?%0D%0DKind regards ` ;
if ( this . Symbol Profile? . assetClass ) {
this . assetClass = translate ( this . Symbol Profile? . assetClass ) ;
if ( this . asset Profile? . assetClass ) {
this . assetClass = translate ( this . asset Profile? . assetClass ) ;
}
if ( this . Symbol Profile? . assetSubClass ) {
this . assetSubClass = translate ( this . Symbol Profile? . assetSubClass ) ;
if ( this . asset Profile? . assetSubClass ) {
this . assetSubClass = translate ( this . asset Profile? . assetSubClass ) ;
}
if ( this . Symbol Profile? . countries ? . length > 0 ) {
for ( const country of this . Symbol Profile. countries ) {
if ( this . asset Profile? . countries ? . length > 0 ) {
for ( const country of this . asset Profile. countries ) {
this . countries [ country . code ] = {
name : getCountryName ( { code : country.code } ) ,
value : country.weight
@ -449,8 +461,8 @@ export class GfHoldingDetailDialogComponent implements OnInit {
}
}
if ( this . Symbol Profile? . sectors ? . length > 0 ) {
for ( const sector of this . Symbol Profile. sectors ) {
if ( this . asset Profile? . sectors ? . length > 0 ) {
for ( const sector of this . asset Profile. sectors ) {
this . sectors [ sector . name ] = {
name : translate ( sector . name ) ,
value : sector.weight
@ -570,12 +582,12 @@ export class GfHoldingDetailDialogComponent implements OnInit {
const activity : CreateOrderDto = {
accountId : this.accounts.length === 1 ? this . accounts [ 0 ] . id : undefined ,
comment : undefined ,
currency : this.Symbol Profile?.currency ? ? '' ,
dataSource : this.Symbol Profile?.dataSource ,
currency : this.asset Profile?.currency ? ? '' ,
dataSource : this.asset Profile?.dataSource ,
date : today.toISOString ( ) ,
fee : 0 ,
quantity : this.quantity ,
symbol : this . Symbol Profile? . symbol ? ? '' ,
symbol : this . asset Profile? . symbol ? ? '' ,
tags : this.tags.map ( ( { id } ) = > {
return id ;
} ) ,
@ -606,7 +618,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
. subscribe ( ( data ) = > {
downloadAsFile ( {
content : data ,
fileName : ` ghostfolio-export- ${ this . Symbol Profile? . symbol } - ${ format (
fileName : ` ghostfolio-export- ${ this . asset Profile? . symbol } - ${ format (
parseISO ( data . meta . date ) ,
'yyyyMMddHHmm'
) } . json ` ,