Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/skip derived currencies in get quotes of data provider service (#3610)

Thomas Kaul97db144e01d3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e2dcfd96d..d1064af947 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 9a468f10e9..58574a3b59 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;