Skip to content

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

Task/remove deprecated fear and greed index symbol (#7103)

Thomas Kaul6e97a3c97871
diff --git a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts
index 9941ae9eb2..d8ba1ec67f 100644
--- a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts
+++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts
@@ -8,10 +8,7 @@ import {
GetSearchParams
} from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface';
import { FetchService } from '@ghostfolio/api/services/fetch/fetch.service';
-import {
- ghostfolioFearAndGreedIndexSymbol,
- ghostfolioFearAndGreedIndexSymbolStocks
-} from '@ghostfolio/common/config';
+import { ghostfolioFearAndGreedIndexSymbolStocks } from '@ghostfolio/common/config';
import { DATE_FORMAT, getYesterday } from '@ghostfolio/common/helper';
import {
DataProviderHistoricalResponse,
@@ -64,12 +61,7 @@ export class RapidApiService implements DataProviderInterface {
[symbol: string]: { [date: string]: DataProviderHistoricalResponse };
}> {
try {
- if (
- [
- ghostfolioFearAndGreedIndexSymbol,
- ghostfolioFearAndGreedIndexSymbolStocks
- ].includes(symbol)
- ) {
+ if (symbol === ghostfolioFearAndGreedIndexSymbolStocks) {
const fgi = await this.getFearAndGreedIndex();
return {
@@ -106,12 +98,7 @@ export class RapidApiService implements DataProviderInterface {
try {
const symbol = symbols[0];
- if (
- [
- ghostfolioFearAndGreedIndexSymbol,
- ghostfolioFearAndGreedIndexSymbolStocks
- ].includes(symbol)
- ) {
+ if (symbol === ghostfolioFearAndGreedIndexSymbolStocks) {
const fgi = await this.getFearAndGreedIndex();
return {
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 ffd0c5452f..4e6fd5bb2c 100644
--- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts
+++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts
@@ -3,7 +3,7 @@ import { BenchmarkService } from '@ghostfolio/api/services/benchmark/benchmark.s
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import {
ghostfolioFearAndGreedIndexDataSourceStocks,
- ghostfolioFearAndGreedIndexSymbol
+ ghostfolioFearAndGreedIndexSymbolStocks
} from '@ghostfolio/common/config';
import {
resolveFearAndGreedIndex,
@@ -49,7 +49,7 @@ export class TwitterBotService implements OnModuleInit {
const symbolItem = await this.symbolService.get({
dataGatheringItem: {
dataSource: ghostfolioFearAndGreedIndexDataSourceStocks,
- symbol: ghostfolioFearAndGreedIndexSymbol
+ symbol: ghostfolioFearAndGreedIndexSymbolStocks
}
});
diff --git a/apps/client/src/app/components/home-market/home-market.component.ts b/apps/client/src/app/components/home-market/home-market.component.ts
index dd0c38cea6..40b8f145b3 100644
--- a/apps/client/src/app/components/home-market/home-market.component.ts
+++ b/apps/client/src/app/components/home-market/home-market.component.ts
@@ -1,6 +1,6 @@
import { GfFearAndGreedIndexComponent } from '@ghostfolio/client/components/fear-and-greed-index/fear-and-greed-index.component';
import { UserService } from '@ghostfolio/client/services/user/user.service';
-import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';
+import { ghostfolioFearAndGreedIndexSymbolStocks } from '@ghostfolio/common/config';
import { resetHours } from '@ghostfolio/common/helper';
import {
Benchmark,
@@ -86,7 +86,7 @@ export class GfHomeMarketComponent implements OnInit {
.fetchSymbolItem({
dataSource: this.info.fearAndGreedDataSource,
includeHistoricalData: this.numberOfDays,
- symbol: ghostfolioFearAndGreedIndexSymbol
+ symbol: ghostfolioFearAndGreedIndexSymbolStocks
})
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ historicalData, marketPrice }) => {
diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts
index e21271ca1e..40412d6275 100644
--- a/libs/common/src/lib/config.ts
+++ b/libs/common/src/lib/config.ts
@@ -5,11 +5,13 @@ import ms from 'ms';
import { ColorScheme, DateRange } from './types';
export const ghostfolioPrefix = 'GF';
+
+/* @deprecated */
export const ghostfolioScraperApiSymbolPrefix = `_${ghostfolioPrefix}_`;
+
export const ghostfolioFearAndGreedIndexDataSourceCryptocurrencies =
DataSource.MANUAL;
export const ghostfolioFearAndGreedIndexDataSourceStocks = DataSource.RAPID_API;
-export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`;
export const ghostfolioFearAndGreedIndexSymbolCryptocurrencies = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_CRYPTOCURRENCIES`;
export const ghostfolioFearAndGreedIndexSymbolStocks = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_STOCKS`;
diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts
index 5bd6671f20..3219ed553c 100644
--- a/libs/common/src/lib/helper.ts
+++ b/libs/common/src/lib/helper.ts
@@ -38,7 +38,6 @@ import {
DEFAULT_CURRENCY,
DEFAULT_LOCALE,
DERIVED_CURRENCIES,
- ghostfolioFearAndGreedIndexSymbol,
ghostfolioFearAndGreedIndexSymbolCryptocurrencies,
ghostfolioFearAndGreedIndexSymbolStocks,
ghostfolioScraperApiSymbolPrefix
@@ -157,7 +156,6 @@ export function canDeleteAssetProfile({
!isBenchmark &&
!isDerivedCurrency(getCurrencyFromSymbol(symbol)) &&
!isRootCurrency(getCurrencyFromSymbol(symbol)) &&
- symbol !== ghostfolioFearAndGreedIndexSymbol &&
symbol !== ghostfolioFearAndGreedIndexSymbolCryptocurrencies &&
symbol !== ghostfolioFearAndGreedIndexSymbolStocks &&
watchedByCount === 0