diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd09672..576737e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Improved the data source validation in the activities import +- Changed _Twitter_ to _𝕏_ +- Improved selection in the twitter bot service - Improved the language localization for German (`de`) - Upgraded `ng-extract-i18n-merge` from version `2.7.0` to `2.8.3` - Upgraded `prettier` from version `3.0.3` to `3.1.0` diff --git a/apps/api/src/app/benchmark/benchmark.service.ts b/apps/api/src/app/benchmark/benchmark.service.ts index 1f143fa2..93f4ecc9 100644 --- a/apps/api/src/app/benchmark/benchmark.service.ts +++ b/apps/api/src/app/benchmark/benchmark.service.ts @@ -73,9 +73,10 @@ export class BenchmarkService { return { trend50d: fiftyDayAverage, trend200d: twoHundredDayAverage }; } - public async getBenchmarks({ useCache = true } = {}): Promise< - BenchmarkResponse['benchmarks'] - > { + public async getBenchmarks({ + enableSharing = false, + useCache = true + } = {}): Promise { let benchmarks: BenchmarkResponse['benchmarks']; if (useCache) { @@ -90,7 +91,9 @@ export class BenchmarkService { } catch {} } - const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); + const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles({ + enableSharing + }); const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] = []; @@ -162,14 +165,24 @@ export class BenchmarkService { return benchmarks; } - public async getBenchmarkAssetProfiles(): Promise[]> { + public async getBenchmarkAssetProfiles({ + enableSharing = false + } = {}): Promise[]> { const symbolProfileIds: string[] = ( ((await this.propertyService.getByKey( PROPERTY_BENCHMARKS )) as BenchmarkProperty[]) ?? [] - ).map(({ symbolProfileId }) => { - return symbolProfileId; - }); + ) + .filter((benchmark) => { + if (enableSharing) { + return benchmark.enableSharing; + } + + return true; + }) + .map(({ symbolProfileId }) => { + return symbolProfileId; + }); const assetProfiles = await this.symbolProfileService.getSymbolProfilesByIds(symbolProfileIds); 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 d3e7fb91..02a11b74 100644 --- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts +++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts @@ -57,7 +57,7 @@ export class TwitterBotService { symbolItem.marketPrice }/100)`; - const benchmarkListing = await this.getBenchmarkListing(3); + const benchmarkListing = await this.getBenchmarkListing(); if (benchmarkListing?.length > 1) { status += '\n\n'; @@ -78,29 +78,22 @@ export class TwitterBotService { } } - private async getBenchmarkListing(aMax: number) { + private async getBenchmarkListing() { const benchmarks = await this.benchmarkService.getBenchmarks({ + enableSharing: true, useCache: false }); - const benchmarkListing: string[] = []; - - for (const [index, benchmark] of benchmarks.entries()) { - if (index > aMax - 1) { - break; - } - - benchmarkListing.push( - `${benchmark.name} ${( - benchmark.performances.allTimeHigh.performancePercent * 100 + return benchmarks + .map(({ marketCondition, name, performances }) => { + return `${name} ${( + performances.allTimeHigh.performancePercent * 100 ).toFixed(1)}%${ - benchmark.marketCondition !== 'NEUTRAL_MARKET' - ? ' ' + resolveMarketCondition(benchmark.marketCondition).emoji + marketCondition !== 'NEUTRAL_MARKET' + ? ' ' + resolveMarketCondition(marketCondition).emoji : '' - }` - ); - } - - return benchmarkListing.join('\n'); + }`; + }) + .join('\n'); } } diff --git a/apps/client/src/app/app.component.html b/apps/client/src/app/app.component.html index 31281fe4..41577076 100644 --- a/apps/client/src/app/app.component.html +++ b/apps/client/src/app/app.component.html @@ -127,8 +127,11 @@ class="align-items-baseline d-flex" href="https://twitter.com/ghostfolio_" target="_blank" - title="Follow Ghostfolio on Twitter" - >TwitterX (formerly Twitter)
  •  
  • diff --git a/apps/client/src/app/pages/about/overview/about-overview-page.html b/apps/client/src/app/pages/about/overview/about-overview-page.html index 4dc9fbf7..02cbf7de 100644 --- a/apps/client/src/app/pages/about/overview/about-overview-page.html +++ b/apps/client/src/app/pages/about/overview/about-overview-page.html @@ -55,7 +55,7 @@ community, tweet to @ghostfolio_, send an e-mail to @@ -70,14 +70,14 @@ >GitHub.

    -

    +

    - + 𝕏 @ghostfolio_, @@ -262,7 +262,7 @@ >community, tweet to @ghostfolio_, send an e-mail to diff --git a/libs/common/src/lib/interfaces/benchmark-property.interface.ts b/libs/common/src/lib/interfaces/benchmark-property.interface.ts index bccf4ed7..a6c4958e 100644 --- a/libs/common/src/lib/interfaces/benchmark-property.interface.ts +++ b/libs/common/src/lib/interfaces/benchmark-property.interface.ts @@ -1,3 +1,4 @@ export interface BenchmarkProperty { + enableSharing?: boolean; symbolProfileId: string; }