Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/eliminate search request in get quotes of eod service (#3019)
Thomas Kaul266c0a9a2c0a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b3d9f3513d..5f75b1e554 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Improved the usability of the holdings table- Refactored the query to filter activities of excluded accounts+- Eliminated the search request to get quotes in the _EOD Historical Data_ service- Improved the language localization for German (`de`)- Upgraded `ng-extract-i18n-merge` from version `2.9.1` to `2.10.0`diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.tsindex 3d3bf39e5f..798973be6c 100644--- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts+++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts@@ -11,6 +11,7 @@ import {IDataProviderHistoricalResponse,IDataProviderResponse} from '@ghostfolio/api/services/interfaces/interfaces';+import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';import {DEFAULT_CURRENCY,REPLACE_NAME_PARTS@@ -35,7 +36,8 @@ export class EodHistoricalDataService implements DataProviderInterface {private readonly URL = 'https://eodhistoricaldata.com/api';public constructor(- private readonly configurationService: ConfigurationService+ private readonly configurationService: ConfigurationService,+ private readonly symbolProfileService: SymbolProfileService) {this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA');}@@ -228,27 +230,22 @@ export class EodHistoricalDataService implements DataProviderInterface {? [realTimeResponse]: realTimeResponse;- const searchResponse = await Promise.all(- eodHistoricalDataSymbols- .filter((symbol) => {- return !symbol.endsWith('.FOREX');- })- .map((symbol) => {- return this.search({ query: symbol });- })+ const symbolProfiles = await this.symbolProfileService.getSymbolProfiles(+ symbols.map((symbol) => {+ return {+ symbol,+ dataSource: this.getName()+ };+ }));- const lookupItems = searchResponse.flat().map(({ items }) => {- return items[0];- });-response = quotes.reduce((result: { [symbol: string]: IDataProviderResponse },{ close, code, timestamp }) => {- const currency = lookupItems.find((lookupItem) => {- return lookupItem.symbol === code;+ const currency = symbolProfiles.find(({ symbol }) => {+ return symbol === code;})?.currency;if (isNumber(close)) {