diff --git a/CHANGELOG.md b/CHANGELOG.md index 088f7c4f0..9c6a4fc79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the language localization by translating various tooltips across the application -## 3.19.0 - 2026-07-02 +## 3.19.1 - 2026-07-03 ### Added @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Harmonized the date picker styling across various components - Updated the _Privacy Policy_ - Updated the _Terms of Service_ - Improved the parsing of integer query parameters (`skip` and `take`) in the `GET api/v1/activities` endpoint @@ -30,6 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue where values incorrectly rounded to negative zero in the value component +- Fixed the colorization of the change from all time high in the benchmark component when values round to zero +- Fixed the market condition of the benchmarks when values round to zero - Fixed the validation of the data source field of an asset profile with market data - Fixed a recurring issue where single-value fields were incorrectly validated as arrays in various endpoints diff --git a/apps/api/src/services/benchmark/benchmark.service.spec.ts b/apps/api/src/services/benchmark/benchmark.service.spec.ts index 833dbcdfc..0e7119b04 100644 --- a/apps/api/src/services/benchmark/benchmark.service.spec.ts +++ b/apps/api/src/services/benchmark/benchmark.service.spec.ts @@ -12,4 +12,16 @@ describe('BenchmarkService', () => { expect(benchmarkService.calculateChangeInPercentage(2, 2)).toEqual(0); expect(benchmarkService.calculateChangeInPercentage(2, 1)).toEqual(-0.5); }); + + it('getMarketCondition', async () => { + expect(benchmarkService.getMarketCondition(0)).toEqual('ALL_TIME_HIGH'); + expect(benchmarkService.getMarketCondition(-5.90736454893e-9)).toEqual( + 'ALL_TIME_HIGH' + ); + expect(benchmarkService.getMarketCondition(-0.1)).toEqual('NEUTRAL_MARKET'); + expect(benchmarkService.getMarketCondition(-0.19996)).toEqual( + 'BEAR_MARKET' + ); + expect(benchmarkService.getMarketCondition(-0.2)).toEqual('BEAR_MARKET'); + }); }); diff --git a/apps/api/src/services/benchmark/benchmark.service.ts b/apps/api/src/services/benchmark/benchmark.service.ts index 56a629163..99ceaf21e 100644 --- a/apps/api/src/services/benchmark/benchmark.service.ts +++ b/apps/api/src/services/benchmark/benchmark.service.ts @@ -24,7 +24,7 @@ import { Injectable, Logger } from '@nestjs/common'; import { SymbolProfile } from '@prisma/client'; import { Big } from 'big.js'; import { addHours, isAfter, subDays } from 'date-fns'; -import { uniqBy } from 'lodash'; +import { round, uniqBy } from 'lodash'; import ms from 'ms'; import { BenchmarkValue } from './interfaces/benchmark-value.interface'; @@ -220,9 +220,11 @@ export class BenchmarkService { public getMarketCondition( aPerformanceInPercent: number ): Benchmark['marketCondition'] { - if (aPerformanceInPercent >= 0) { + const performanceInPercent = round(aPerformanceInPercent, 4); + + if (performanceInPercent >= 0) { return 'ALL_TIME_HIGH'; - } else if (aPerformanceInPercent <= -0.2) { + } else if (performanceInPercent <= -0.2) { return 'BEAR_MARKET'; } else { return 'NEUTRAL_MARKET'; diff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.html index ae3121861..35f072d72 100644 --- a/apps/client/src/app/components/header/header.component.html +++ b/apps/client/src/app/components/header/header.component.html @@ -332,7 +332,7 @@ } - @if (user() === null) { + @if (!user()) {
-