Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/fix algebraic sign in twitter bot service (#4158)

Thomas Kaul167abe41074b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fe75a2fdc..a483c5bd9a 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 163b8e9c3f..a32882aed9 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
: ''