From 97db144e01d3d233dab1e9913f39319ce8cee890 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Jul 2024 19:47:06 +0200 Subject: [PATCH] Feature/skip derived currencies in get quotes of data provider service (#3610) * Skip derived currencies * Update changelog --- CHANGELOG.md | 3 ++- .../data-provider/data-provider.service.ts | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2dcfd96..d1064af94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Improved the handling of the numerical precision in the value component - Improved the account selector of the create or update activity dialog +- Improved the handling of the numerical precision in the value component +- Skipped derived currencies in the get quotes functionality of the data provider service - Improved the language localization for Spanish (`es`) - Upgraded `angular` from version `18.0.4` to `18.1.1` - Upgraded `Nx` from version `19.4.3` to `19.5.1` diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 9a468f10e..58574a3b5 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -14,7 +14,12 @@ import { DERIVED_CURRENCIES, PROPERTY_DATA_SOURCE_MAPPING } from '@ghostfolio/common/config'; -import { DATE_FORMAT, getStartOfUtcDate } from '@ghostfolio/common/helper'; +import { + DATE_FORMAT, + getCurrencyFromSymbol, + getStartOfUtcDate, + isDerivedCurrency +} from '@ghostfolio/common/helper'; import { UniqueAsset } from '@ghostfolio/common/interfaces'; import type { Granularity, UserWithSettings } from '@ghostfolio/common/types'; @@ -423,13 +428,18 @@ export class DataProviderService { continue; } - const symbols = dataGatheringItems.map((dataGatheringItem) => { - return dataGatheringItem.symbol; - }); + const symbols = dataGatheringItems + .filter(({ symbol }) => { + return !isDerivedCurrency(getCurrencyFromSymbol(symbol)); + }) + .map(({ symbol }) => { + return symbol; + }); const maximumNumberOfSymbolsPerRequest = dataProvider.getMaxNumberOfSymbolsPerRequest?.() ?? Number.MAX_SAFE_INTEGER; + for ( let i = 0; i < symbols.length;