From 0fdc209da547863bbc90ec06067136139b536893 Mon Sep 17 00:00:00 2001 From: Alexander Linder Date: Fri, 26 Jun 2026 22:19:16 +0200 Subject: [PATCH 1/3] Fix symbol mapping for manual assets --- .../data-gathering/data-gathering.service.ts | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts index 1a2fa720e..b1eeb18b4 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts @@ -72,11 +72,7 @@ export class DataGatheringService { public async gatherAssetProfiles( aAssetProfileIdentifiers?: AssetProfileIdentifier[] ) { - let assetProfileIdentifiers = aAssetProfileIdentifiers?.filter( - (dataGatheringItem) => { - return dataGatheringItem.dataSource !== 'MANUAL'; - } - ); + let assetProfileIdentifiers = aAssetProfileIdentifiers; if (!assetProfileIdentifiers) { assetProfileIdentifiers = await this.getActiveAssetProfileIdentifiers(); @@ -86,10 +82,31 @@ export class DataGatheringService { return; } - const assetProfiles = await this.dataProviderService.getAssetProfiles( + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( assetProfileIdentifiers ); - const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + + // Exclude MANUAL asset profiles unless they define a symbol mapping that + // lets data enhancers gather profile data from another data source + assetProfileIdentifiers = assetProfileIdentifiers.filter( + ({ dataSource, symbol }) => { + if (dataSource !== 'MANUAL') { + return true; + } + + const symbolProfile = symbolProfiles.find((profile) => { + return profile.dataSource === dataSource && profile.symbol === symbol; + }); + + return !isEmpty(symbolProfile?.symbolMapping); + } + ); + + if (assetProfileIdentifiers.length <= 0) { + return; + } + + const assetProfiles = await this.dataProviderService.getAssetProfiles( assetProfileIdentifiers ); @@ -372,15 +389,16 @@ export class DataGatheringService { }: { maxAge?: StringValue; } = {}): Promise { - return this.prismaService.symbolProfile.findMany({ + const symbolProfiles = await this.prismaService.symbolProfile.findMany({ orderBy: [{ symbol: 'asc' }, { dataSource: 'asc' }], select: { dataSource: true, - symbol: true + symbol: true, + symbolMapping: true }, where: { dataSource: { - notIn: ['MANUAL', 'RAPID_API'] + not: 'RAPID_API' }, isActive: true, ...(maxAge && { @@ -390,6 +408,16 @@ export class DataGatheringService { }) } }); + + return symbolProfiles + .filter(({ dataSource, symbolMapping }) => { + // Include MANUAL asset profiles only when they define a symbol mapping + // that lets data enhancers gather profile data from another data source + return dataSource !== 'MANUAL' || !isEmpty(symbolMapping); + }) + .map(({ dataSource, symbol }) => { + return { dataSource, symbol }; + }); } private async getAssetProfileIdentifiersWithCompleteMarketData(): Promise< From 2e2e79e8506206f415afc9d8824f3df30b2b160f Mon Sep 17 00:00:00 2001 From: Alexander Linder Date: Fri, 26 Jun 2026 22:24:18 +0200 Subject: [PATCH 2/3] Remove parameter reassignment --- .../services/queues/data-gathering/data-gathering.service.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts index b1eeb18b4..fc2ec97e9 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts @@ -70,10 +70,8 @@ export class DataGatheringService { } public async gatherAssetProfiles( - aAssetProfileIdentifiers?: AssetProfileIdentifier[] + assetProfileIdentifiers?: AssetProfileIdentifier[] ) { - let assetProfileIdentifiers = aAssetProfileIdentifiers; - if (!assetProfileIdentifiers) { assetProfileIdentifiers = await this.getActiveAssetProfileIdentifiers(); } From a9a556ed70db5d4f90586f6af792bbae4d5f242a Mon Sep 17 00:00:00 2001 From: Alexander Linder Date: Mon, 29 Jun 2026 12:17:43 +0200 Subject: [PATCH 3/3] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0722a3d5b..2831805c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for routing outgoing requests through a per-domain proxy via the `PROXY_ROUTES` setting in the `FetchService` +### Fixed + +- Fixed symbol mapping for asset profiles with the `MANUAL` data source + ## 3.18.0 - 2026-06-28 ### Added