Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix fear and greed index (#359)
Thomas Kaul3c46bde8d50d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 76ca40d905..65b2007f63 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Fixed++- Fixed the _Fear & Greed Index_ (market mood)+## 1.49.0 - 08.09.2021### Addeddiff --git a/apps/api/src/app/symbol/symbol.service.ts b/apps/api/src/app/symbol/symbol.service.tsindex 2be74b19ba..3fdb2f7533 100644--- a/apps/api/src/app/symbol/symbol.service.ts+++ b/apps/api/src/app/symbol/symbol.service.ts@@ -17,7 +17,7 @@ export class SymbolService {const response = await this.dataProviderService.get([aSymbol]);const { currency, dataSource, marketPrice } = response[aSymbol] ?? {};- if (currency && dataSource && marketPrice) {+ if (dataSource && marketPrice) {return {dataSource,marketPrice,diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering.service.tsindex c4a3fd0ec2..fa988f7391 100644--- a/apps/api/src/services/data-gathering.service.ts+++ b/apps/api/src/services/data-gathering.service.ts@@ -1,4 +1,8 @@-import { benchmarks, currencyPairs } from '@ghostfolio/common/config';+import {+ benchmarks,+ currencyPairs,+ ghostfolioFearAndGreedIndexSymbol+} from '@ghostfolio/common/config';import {DATE_FORMAT,getUtc,@@ -295,7 +299,7 @@ export class DataGatheringService {benchmarksToGather.push({dataSource: DataSource.RAKUTEN,date: startDate,- symbol: 'GF.FEAR_AND_GREED_INDEX'+ symbol: ghostfolioFearAndGreedIndexSymbol});}diff --git a/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts b/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.tsindex 3b07301ab0..a230f88bdd 100644--- a/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts+++ b/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts@@ -1,6 +1,7 @@import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';import { PrismaService } from '@ghostfolio/api/services/prisma.service';+import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';import {DATE_FORMAT,getToday,@@ -47,11 +48,11 @@ export class RakutenRapidApiService implements DataProviderInterface {try {const symbol = aSymbols[0];- if (symbol === 'GF.FEAR_AND_GREED_INDEX') {+ if (symbol === ghostfolioFearAndGreedIndexSymbol) {const fgi = await this.getFearAndGreedIndex();return {- 'GF.FEAR_AND_GREED_INDEX': {+ [ghostfolioFearAndGreedIndexSymbol]: {currency: undefined,dataSource: DataSource.RAKUTEN,marketPrice: fgi.now.value,@@ -82,7 +83,7 @@ export class RakutenRapidApiService implements DataProviderInterface {try {const symbol = aSymbols[0];- if (symbol === 'GF.FEAR_AND_GREED_INDEX') {+ if (symbol === ghostfolioFearAndGreedIndexSymbol) {const fgi = await this.getFearAndGreedIndex();try {@@ -118,7 +119,7 @@ export class RakutenRapidApiService implements DataProviderInterface {} catch {}return {- 'GF.FEAR_AND_GREED_INDEX': {+ [ghostfolioFearAndGreedIndexSymbol]: {[format(getYesterday(), DATE_FORMAT)]: {marketPrice: fgi.previousClose.value}diff --git a/apps/client/src/app/pages/home/home-page.component.ts b/apps/client/src/app/pages/home/home-page.component.tsindex aaad1e32f8..ce9b96956c 100644--- a/apps/client/src/app/pages/home/home-page.component.ts+++ b/apps/client/src/app/pages/home/home-page.component.ts@@ -20,6 +20,7 @@ import {SettingsStorageService} from '@ghostfolio/client/services/settings-storage.service';import { UserService } from '@ghostfolio/client/services/user/user.service';+import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';import {PortfolioPerformance,PortfolioSummary,@@ -111,7 +112,7 @@ export class HomePageComponent implements OnDestroy, OnInit {if (this.hasPermissionToAccessFearAndGreedIndex) {this.dataService- .fetchSymbolItem('GF.FEAR_AND_GREED_INDEX')+ .fetchSymbolItem(ghostfolioFearAndGreedIndexSymbol).pipe(takeUntil(this.unsubscribeSubject)).subscribe(({ marketPrice }) => {this.fearAndGreedIndex = marketPrice;diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.tsindex 295ce68c05..6b27b7faee 100644--- a/libs/common/src/lib/config.ts+++ b/libs/common/src/lib/config.ts@@ -28,6 +28,7 @@ export const currencyPairs: Partial<export const ghostfolioScraperApiSymbolPrefix = '_GF_';export const ghostfolioCashSymbol = `${ghostfolioScraperApiSymbolPrefix}CASH`;+export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`;export const locale = 'de-CH';