Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/increase fear and greed index to 365 days (#1519)
Thomas Kaul4f187e1a9f57
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 01c98d885a..9392947652 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- Increased the historical data chart of the _Fear & Greed Index_ (market mood) to 365 days- Upgraded `color` from version `4.0.1` to `4.2.3`- Upgraded `prettier` from version `2.7.1` to `2.8.1`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.tsindex 5aace3d24f..1bf0577458 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@@ -5,20 +5,18 @@ import {IDataProviderHistoricalResponse,IDataProviderResponse} from '@ghostfolio/api/services/interfaces/interfaces';-import { PrismaService } from '@ghostfolio/api/services/prisma.service';import { ghostfolioFearAndGreedIndexSymbol } from '@ghostfolio/common/config';-import { DATE_FORMAT, getToday, getYesterday } from '@ghostfolio/common/helper';+import { DATE_FORMAT, getYesterday } from '@ghostfolio/common/helper';import { Granularity } from '@ghostfolio/common/types';import { Injectable, Logger } from '@nestjs/common';import { DataSource, SymbolProfile } from '@prisma/client';import bent from 'bent';-import { format, subMonths, subWeeks, subYears } from 'date-fns';+import { format } from 'date-fns';@Injectable()export class RapidApiService implements DataProviderInterface {public constructor(- private readonly configurationService: ConfigurationService,- private readonly prismaService: PrismaService+ private readonly configurationService: ConfigurationService) {}public canHandle(symbol: string) {@@ -47,41 +45,6 @@ export class RapidApiService implements DataProviderInterface {if (symbol === ghostfolioFearAndGreedIndexSymbol) {const fgi = await this.getFearAndGreedIndex();- try {- // Rebuild historical data- // TODO: can be removed after all data from the last year has been gathered- // (introduced on 27.03.2021)-- await this.prismaService.marketData.create({- data: {- symbol,- dataSource: this.getName(),- date: subWeeks(getToday(), 1),- marketPrice: fgi.oneWeekAgo.value- }- });-- await this.prismaService.marketData.create({- data: {- symbol,- dataSource: this.getName(),- date: subMonths(getToday(), 1),- marketPrice: fgi.oneMonthAgo.value- }- });-- await this.prismaService.marketData.create({- data: {- symbol,- dataSource: this.getName(),- date: subYears(getToday(), 1),- marketPrice: fgi.oneYearAgo.value- }- });-- ///////////////////////////////////////////////////////////////////////////- } catch {}-return {[ghostfolioFearAndGreedIndexSymbol]: {[format(getYesterday(), DATE_FORMAT)]: {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.tsindex 2d2e1bffe5..e45a4d6476 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@@ -27,7 +27,7 @@ export class HomeMarketComponent implements OnDestroy, OnInit {public historicalDataItems: HistoricalDataItem[];public info: InfoItem;public isLoading = true;- public readonly numberOfDays = 180;+ public readonly numberOfDays = 365;public user: User;private unsubscribeSubject = new Subject<void>();