diff --git a/apps/api/src/app/endpoints/market-data/market-data.controller.ts b/apps/api/src/app/endpoints/market-data/market-data.controller.ts index 2744adab2..c9646c8e6 100644 --- a/apps/api/src/app/endpoints/market-data/market-data.controller.ts +++ b/apps/api/src/app/endpoints/market-data/market-data.controller.ts @@ -72,11 +72,13 @@ export class MarketDataController { ]); return { - CRYPTOCURRENCIES: { - ...marketDataFearAndGreedIndexCryptocurrencies - }, - STOCKS: { - ...marketDataFearAndGreedIndexStocks + fearAndGreedIndex: { + CRYPTOCURRENCIES: { + ...marketDataFearAndGreedIndexCryptocurrencies + }, + STOCKS: { + ...marketDataFearAndGreedIndexStocks + } } }; } diff --git a/apps/client/src/app/components/markets/markets.component.ts b/apps/client/src/app/components/markets/markets.component.ts index b0bbe04ba..cd3a44acd 100644 --- a/apps/client/src/app/components/markets/markets.component.ts +++ b/apps/client/src/app/components/markets/markets.component.ts @@ -6,12 +6,10 @@ import { resetHours } from '@ghostfolio/common/helper'; import { Benchmark, HistoricalDataItem, - InfoItem, MarketDataOfMarketsResponse, ToggleOption, User } from '@ghostfolio/common/interfaces'; -import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { FearAndGreedIndexMode } from '@ghostfolio/common/types'; import { GfBenchmarkComponent } from '@ghostfolio/ui/benchmark'; import { GfLineChartComponent } from '@ghostfolio/ui/line-chart'; @@ -47,17 +45,15 @@ export class MarketsComponent implements OnDestroy, OnInit { public benchmarks: Benchmark[]; public deviceType: string; public fearAndGreedIndex: number; - public fearAndGreedIndexData: MarketDataOfMarketsResponse; + public fearAndGreedIndexData: MarketDataOfMarketsResponse['fearAndGreedIndex']; public fearLabel = $localize`Fear`; public greedLabel = $localize`Greed`; - public hasPermissionToAccessFearAndGreedIndex: boolean; public historicalDataItems: HistoricalDataItem[]; public fearAndGreedIndexMode: FearAndGreedIndexMode = 'STOCKS'; public fearAndGreedIndexModeOptions: ToggleOption[] = [ { label: $localize`Stocks`, value: 'STOCKS' }, { label: $localize`Cryptocurrencies`, value: 'CRYPTOCURRENCIES' } ]; - public info: InfoItem; public readonly numberOfDays = 365; public user: User; @@ -70,7 +66,6 @@ export class MarketsComponent implements OnDestroy, OnInit { private userService: UserService ) { this.deviceType = this.deviceService.getDeviceInfo().deviceType; - this.info = this.dataService.fetchInfo(); this.userService.stateChanged .pipe(takeUntil(this.unsubscribeSubject)) @@ -84,23 +79,16 @@ export class MarketsComponent implements OnDestroy, OnInit { } public ngOnInit() { - this.hasPermissionToAccessFearAndGreedIndex = hasPermission( - this.info?.globalPermissions, - permissions.enableFearAndGreedIndex - ); - - if (this.hasPermissionToAccessFearAndGreedIndex) { - this.dataService - .fetchMarketDataOfMarkets({ includeHistoricalData: this.numberOfDays }) - .pipe(takeUntil(this.unsubscribeSubject)) - .subscribe((fearAndGreedIndexData) => { - this.fearAndGreedIndexData = fearAndGreedIndexData; + this.dataService + .fetchMarketDataOfMarkets({ includeHistoricalData: this.numberOfDays }) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(({ fearAndGreedIndex }) => { + this.fearAndGreedIndexData = fearAndGreedIndex; - this.initialize(); + this.initialize(); - this.changeDetectorRef.markForCheck(); - }); - } + this.changeDetectorRef.markForCheck(); + }); this.dataService .fetchBenchmarks() diff --git a/apps/client/src/app/components/markets/markets.html b/apps/client/src/app/components/markets/markets.html index d2c48c852..2d02fb34a 100644 --- a/apps/client/src/app/components/markets/markets.html +++ b/apps/client/src/app/components/markets/markets.html @@ -1,45 +1,41 @@