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 4 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/),
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
### 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(
dataProvider.getQuotes({ requestTimeout, symbols: symbolsChunk })
dataProvider.getQuotes({
requestTimeout,
useCache,
symbols: symbolsChunk
})
);
promises.push(

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

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

Loading…
Cancel
Save