Feature/highlight all time high in benchmarks of the markets overview (#2740)

* Highlight all time high

* Update changelog
pull/2738/head^2
Thomas Kaul 1 year ago committed by GitHub
parent 25424ad280
commit ffb7cbff50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Extended the benchmarks of the markets overview by the current market condition (all time high)
### Changed
- Upgraded `prisma` from version `5.6.0` to `5.7.0`

@ -14,6 +14,7 @@ import {
calculateBenchmarkTrend
} from '@ghostfolio/common/helper';
import {
Benchmark,
BenchmarkMarketDataDetails,
BenchmarkProperty,
BenchmarkResponse,
@ -339,7 +340,15 @@ export class BenchmarkService {
};
}
private getMarketCondition(aPerformanceInPercent: number) {
return aPerformanceInPercent <= -0.2 ? 'BEAR_MARKET' : 'NEUTRAL_MARKET';
private getMarketCondition(
aPerformanceInPercent: number
): Benchmark['marketCondition'] {
if (aPerformanceInPercent === 0) {
return 'ALL_TIME_HIGH';
} else if (aPerformanceInPercent <= -0.2) {
return 'BEAR_MARKET';
} else {
return 'NEUTRAL_MARKET';
}
}
}

@ -381,10 +381,10 @@ export function resolveFearAndGreedIndex(aValue: number) {
export function resolveMarketCondition(
aMarketCondition: Benchmark['marketCondition']
) {
if (aMarketCondition === 'BEAR_MARKET') {
if (aMarketCondition === 'ALL_TIME_HIGH') {
return { emoji: '🎉' };
} else if (aMarketCondition === 'BEAR_MARKET') {
return { emoji: '🐻' };
} else if (aMarketCondition === 'BULL_MARKET') {
return { emoji: '🐮' };
} else {
return { emoji: '⚪' };
}

@ -3,7 +3,7 @@ import { BenchmarkTrend } from '@ghostfolio/common/types/';
import { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface';
export interface Benchmark {
marketCondition: 'BEAR_MARKET' | 'BULL_MARKET' | 'NEUTRAL_MARKET';
marketCondition: 'ALL_TIME_HIGH' | 'BEAR_MARKET' | 'NEUTRAL_MARKET';
name: EnhancedSymbolProfile['name'];
performances: {
allTimeHigh: {

@ -89,7 +89,7 @@
'text-danger':
element?.performances?.allTimeHigh?.performancePercent < 0,
'text-success':
element?.performances?.allTimeHigh?.performancePercent > 0
element?.performances?.allTimeHigh?.performancePercent === 0
}"
[value]="element?.performances?.allTimeHigh?.performancePercent"
/>

Loading…
Cancel
Save