Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript ๐ค
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/highlight all time high in benchmarks of the markets overview (#2740)
Thomas Kaulffb7cbff50f6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dcecac2533..7cdca7fc43 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -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`diff --git a/apps/api/src/app/benchmark/benchmark.service.ts b/apps/api/src/app/benchmark/benchmark.service.tsindex 93f4ecc9be..cbd5e7e1f8 100644--- a/apps/api/src/app/benchmark/benchmark.service.ts+++ b/apps/api/src/app/benchmark/benchmark.service.ts@@ -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';+ }}}diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.tsindex 0ca83e3baf..16d5d041b8 100644--- a/libs/common/src/lib/helper.ts+++ b/libs/common/src/lib/helper.ts@@ -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: 'โช' };}diff --git a/libs/common/src/lib/interfaces/benchmark.interface.ts b/libs/common/src/lib/interfaces/benchmark.interface.tsindex 2124173fda..2d63b677c7 100644--- a/libs/common/src/lib/interfaces/benchmark.interface.ts+++ b/libs/common/src/lib/interfaces/benchmark.interface.ts@@ -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: {diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.htmlindex 39e1db7c1a..c0fdbf9567 100644--- a/libs/ui/src/lib/benchmark/benchmark.component.html+++ b/libs/ui/src/lib/benchmark/benchmark.component.html@@ -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"/>