Browse Source

Merge a9a556ed70 into 2b2ff0b883

pull/7145/merge
Alexander Linder 2 days ago
committed by GitHub
parent
commit
5b6a833ee9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 50
      apps/api/src/services/queues/data-gathering/data-gathering.service.ts

4
CHANGELOG.md

@ -153,6 +153,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the validation of the data source field of an asset profile with market data - Fixed the validation of the data source field of an asset profile with market data
- Fixed a recurring issue where single-value fields were incorrectly validated as arrays in various endpoints - Fixed a recurring issue where single-value fields were incorrectly validated as arrays in various endpoints
### Fixed
- Fixed symbol mapping for asset profiles with the `MANUAL` data source
## 3.18.0 - 2026-06-28 ## 3.18.0 - 2026-06-28
### Added ### Added

50
apps/api/src/services/queues/data-gathering/data-gathering.service.ts

@ -70,14 +70,8 @@ export class DataGatheringService {
} }
public async gatherAssetProfiles( public async gatherAssetProfiles(
aAssetProfileIdentifiers?: AssetProfileIdentifier[] assetProfileIdentifiers?: AssetProfileIdentifier[]
) { ) {
let assetProfileIdentifiers = aAssetProfileIdentifiers?.filter(
(dataGatheringItem) => {
return dataGatheringItem.dataSource !== 'MANUAL';
}
);
if (!assetProfileIdentifiers) { if (!assetProfileIdentifiers) {
assetProfileIdentifiers = await this.getActiveAssetProfileIdentifiers(); assetProfileIdentifiers = await this.getActiveAssetProfileIdentifiers();
} }
@ -86,10 +80,31 @@ export class DataGatheringService {
return; return;
} }
const assetProfiles = await this.dataProviderService.getAssetProfiles( const symbolProfiles = await this.symbolProfileService.getSymbolProfiles(
assetProfileIdentifiers 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 assetProfileIdentifiers
); );
@ -372,15 +387,16 @@ export class DataGatheringService {
}: { }: {
maxAge?: StringValue; maxAge?: StringValue;
} = {}): Promise<AssetProfileIdentifier[]> { } = {}): Promise<AssetProfileIdentifier[]> {
return this.prismaService.symbolProfile.findMany({ const symbolProfiles = await this.prismaService.symbolProfile.findMany({
orderBy: [{ symbol: 'asc' }, { dataSource: 'asc' }], orderBy: [{ symbol: 'asc' }, { dataSource: 'asc' }],
select: { select: {
dataSource: true, dataSource: true,
symbol: true symbol: true,
symbolMapping: true
}, },
where: { where: {
dataSource: { dataSource: {
notIn: ['MANUAL', 'RAPID_API'] not: 'RAPID_API'
}, },
isActive: true, isActive: true,
...(maxAge && { ...(maxAge && {
@ -390,6 +406,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< private async getAssetProfileIdentifiersWithCompleteMarketData(): Promise<

Loading…
Cancel
Save