From 167abe41074bfc6ac3c3ea0b061067b6c6e46e4a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:23:55 +0100 Subject: [PATCH] Bugfix/fix algebraic sign in twitter bot service (#4158) * Fix -0.0 to 0.0 * Update changelog --- CHANGELOG.md | 4 ++++ .../src/services/twitter-bot/twitter-bot.service.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fe75a2fd..a483c5bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgraded `Nx` from version `20.1.2` to `20.3.0` - Upgraded `zone.js` from version `0.14.10` to `0.15.0` +### Fixed + +- Fixed an issue with the algebraic sign in the twitter bot service + ## 2.131.0 - 2024-12-25 ### Changed diff --git a/apps/api/src/services/twitter-bot/twitter-bot.service.ts b/apps/api/src/services/twitter-bot/twitter-bot.service.ts index 163b8e9c3..a32882aed 100644 --- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts +++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts @@ -87,9 +87,15 @@ export class TwitterBotService { return benchmarks .map(({ marketCondition, name, performances }) => { - return `${name} ${( + let changeFormAllTimeHigh = ( performances.allTimeHigh.performancePercent * 100 - ).toFixed(1)}%${ + ).toFixed(1); + + if (Math.abs(parseFloat(changeFormAllTimeHigh)) === 0) { + changeFormAllTimeHigh = '0.0'; + } + + return `${name} ${changeFormAllTimeHigh}%${ marketCondition !== 'NEUTRAL_MARKET' ? ' ' + resolveMarketCondition(marketCondition).emoji : ''