Feature/highlight all time high in benchmarks of the markets overview (#2740)
* Highlight all time high * Update changelog
This commit is contained in:
parent
25424ad280
commit
ffb7cbff50
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Extended the benchmarks of the markets overview by the current market condition (all time high)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Upgraded `prisma` from version `5.6.0` to `5.7.0`
|
- Upgraded `prisma` from version `5.6.0` to `5.7.0`
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
calculateBenchmarkTrend
|
calculateBenchmarkTrend
|
||||||
} from '@ghostfolio/common/helper';
|
} from '@ghostfolio/common/helper';
|
||||||
import {
|
import {
|
||||||
|
Benchmark,
|
||||||
BenchmarkMarketDataDetails,
|
BenchmarkMarketDataDetails,
|
||||||
BenchmarkProperty,
|
BenchmarkProperty,
|
||||||
BenchmarkResponse,
|
BenchmarkResponse,
|
||||||
@ -339,7 +340,15 @@ export class BenchmarkService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private getMarketCondition(aPerformanceInPercent: number) {
|
private getMarketCondition(
|
||||||
return aPerformanceInPercent <= -0.2 ? 'BEAR_MARKET' : 'NEUTRAL_MARKET';
|
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(
|
export function resolveMarketCondition(
|
||||||
aMarketCondition: Benchmark['marketCondition']
|
aMarketCondition: Benchmark['marketCondition']
|
||||||
) {
|
) {
|
||||||
if (aMarketCondition === 'BEAR_MARKET') {
|
if (aMarketCondition === 'ALL_TIME_HIGH') {
|
||||||
|
return { emoji: '🎉' };
|
||||||
|
} else if (aMarketCondition === 'BEAR_MARKET') {
|
||||||
return { emoji: '🐻' };
|
return { emoji: '🐻' };
|
||||||
} else if (aMarketCondition === 'BULL_MARKET') {
|
|
||||||
return { emoji: '🐮' };
|
|
||||||
} else {
|
} else {
|
||||||
return { emoji: '⚪' };
|
return { emoji: '⚪' };
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import { BenchmarkTrend } from '@ghostfolio/common/types/';
|
|||||||
import { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface';
|
import { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface';
|
||||||
|
|
||||||
export interface Benchmark {
|
export interface Benchmark {
|
||||||
marketCondition: 'BEAR_MARKET' | 'BULL_MARKET' | 'NEUTRAL_MARKET';
|
marketCondition: 'ALL_TIME_HIGH' | 'BEAR_MARKET' | 'NEUTRAL_MARKET';
|
||||||
name: EnhancedSymbolProfile['name'];
|
name: EnhancedSymbolProfile['name'];
|
||||||
performances: {
|
performances: {
|
||||||
allTimeHigh: {
|
allTimeHigh: {
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
'text-danger':
|
'text-danger':
|
||||||
element?.performances?.allTimeHigh?.performancePercent < 0,
|
element?.performances?.allTimeHigh?.performancePercent < 0,
|
||||||
'text-success':
|
'text-success':
|
||||||
element?.performances?.allTimeHigh?.performancePercent > 0
|
element?.performances?.allTimeHigh?.performancePercent === 0
|
||||||
}"
|
}"
|
||||||
[value]="element?.performances?.allTimeHigh?.performancePercent"
|
[value]="element?.performances?.allTimeHigh?.performancePercent"
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user