|
@ -11,7 +11,7 @@ import { |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { |
|
|
import { |
|
|
DATE_FORMAT, |
|
|
DATE_FORMAT, |
|
|
calculateBenchmarkTrend, |
|
|
calculateBenchmarkTrend |
|
|
} from '@ghostfolio/common/helper'; |
|
|
} from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
import { |
|
|
BenchmarkMarketDataDetails, |
|
|
BenchmarkMarketDataDetails, |
|
@ -39,7 +39,7 @@ export class BenchmarkService { |
|
|
private readonly redisCacheService: RedisCacheService, |
|
|
private readonly redisCacheService: RedisCacheService, |
|
|
private readonly symbolProfileService: SymbolProfileService, |
|
|
private readonly symbolProfileService: SymbolProfileService, |
|
|
private readonly symbolService: SymbolService |
|
|
private readonly symbolService: SymbolService |
|
|
) { } |
|
|
) {} |
|
|
|
|
|
|
|
|
public calculateChangeInPercentage(baseValue: number, currentValue: number) { |
|
|
public calculateChangeInPercentage(baseValue: number, currentValue: number) { |
|
|
if (baseValue && currentValue) { |
|
|
if (baseValue && currentValue) { |
|
@ -88,7 +88,7 @@ export class BenchmarkService { |
|
|
if (benchmarks) { |
|
|
if (benchmarks) { |
|
|
return benchmarks; |
|
|
return benchmarks; |
|
|
} |
|
|
} |
|
|
} catch { } |
|
|
} catch {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); |
|
|
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); |
|
@ -226,9 +226,9 @@ export class BenchmarkService { |
|
|
marketPriceAtStartDate === 0 |
|
|
marketPriceAtStartDate === 0 |
|
|
? 0 |
|
|
? 0 |
|
|
: this.calculateChangeInPercentage( |
|
|
: this.calculateChangeInPercentage( |
|
|
marketPriceAtStartDate, |
|
|
marketPriceAtStartDate, |
|
|
marketDataItem.marketPrice |
|
|
marketDataItem.marketPrice |
|
|
) * 100 |
|
|
) * 100 |
|
|
}; |
|
|
}; |
|
|
}) |
|
|
}) |
|
|
] |
|
|
] |
|
|