Browse Source

Bugfix/hourly market data updates not refreshing prices for asset profiles with manual data source (#7122)

* Fix hourly market data updates not refreshing prices for MANUAL asset profiles

* Update changelog
pull/7126/head^2
Thomas Kaul 5 days ago
committed by GitHub
parent
commit
020c982e73
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 6
      apps/api/src/services/data-provider/data-provider.service.ts
  3. 1
      apps/api/src/services/data-provider/interfaces/data-provider.interface.ts
  4. 45
      apps/api/src/services/data-provider/manual/manual.service.ts

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed an issue with hourly market data updates not refreshing prices for asset profiles with `MANUAL` data source
## 3.15.1 - 2026-06-23 ## 3.15.1 - 2026-06-23
### Changed ### Changed

6
apps/api/src/services/data-provider/data-provider.service.ts

@ -662,7 +662,11 @@ export class DataProviderService implements OnModuleInit {
); );
const promise = Promise.resolve( const promise = Promise.resolve(
dataProvider.getQuotes({ requestTimeout, symbols: symbolsChunk }) dataProvider.getQuotes({
requestTimeout,
useCache,
symbols: symbolsChunk
})
); );
promises.push( promises.push(

1
apps/api/src/services/data-provider/interfaces/data-provider.interface.ts

@ -75,6 +75,7 @@ export interface GetHistoricalParams {
export interface GetQuotesParams { export interface GetQuotesParams {
requestTimeout?: number; requestTimeout?: number;
symbols: string[]; symbols: string[];
useCache?: boolean;
} }
export interface GetSearchParams { export interface GetSearchParams {

45
apps/api/src/services/data-provider/manual/manual.service.ts

@ -136,7 +136,8 @@ export class ManualService implements DataProviderInterface {
} }
public async getQuotes({ public async getQuotes({
symbols symbols,
useCache = true
}: GetQuotesParams): Promise<{ [symbol: string]: DataProviderResponse }> { }: GetQuotesParams): Promise<{ [symbol: string]: DataProviderResponse }> {
const response: { [symbol: string]: DataProviderResponse } = {}; const response: { [symbol: string]: DataProviderResponse } = {};
@ -164,32 +165,32 @@ export class ManualService implements DataProviderInterface {
} }
}); });
const symbolProfilesWithScraperConfigurationAndInstantMode = const symbolProfilesToScrape = symbolProfiles.filter(
symbolProfiles.filter(({ scraperConfiguration }) => { ({ scraperConfiguration }) => {
return ( return (
scraperConfiguration?.mode === 'instant' && (scraperConfiguration?.mode === 'instant' || !useCache) &&
scraperConfiguration?.selector && scraperConfiguration?.selector &&
scraperConfiguration?.url scraperConfiguration?.url
); );
}); }
);
const scraperResultPromises =
symbolProfilesWithScraperConfigurationAndInstantMode.map( const scraperResultPromises = symbolProfilesToScrape.map(
async ({ scraperConfiguration, symbol }) => { async ({ scraperConfiguration, symbol }) => {
try { try {
const marketPrice = await this.scrape({ const marketPrice = await this.scrape({
scraperConfiguration, scraperConfiguration,
symbol symbol
}); });
return { marketPrice, symbol }; return { marketPrice, symbol };
} catch (error) { } catch (error) {
this.logger.error( this.logger.error(
`Could not get quote for ${symbol} (${this.getName()}): [${error.name}] ${error.message}` `Could not get quote for ${symbol} (${this.getName()}): [${error.name}] ${error.message}`
); );
return { symbol, marketPrice: undefined }; return { symbol, marketPrice: undefined };
}
} }
); }
);
// Wait for all scraping requests to complete concurrently // Wait for all scraping requests to complete concurrently
const scraperResults = await Promise.all(scraperResultPromises); const scraperResults = await Promise.all(scraperResultPromises);

Loading…
Cancel
Save