From db54f54899b2030a98fcca6d55ffb4c37a159fd9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 20 Jun 2026 17:55:29 +0200 Subject: [PATCH] Add data gathering frequency to symbol profile and gather hourly --- .../data-gathering/data-gathering.service.ts | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 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 baa2853c8..dfd371a13 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 @@ -156,46 +156,6 @@ export class DataGatheringService { } } - public async gatherHourlySymbols() { - const assetProfileIdentifiers = - await this.getHourlyAssetProfileIdentifiers(); - - if (assetProfileIdentifiers.length <= 0) { - return; - } - - const date = getStartOfUtcDate(new Date()); - - try { - const quotes = await this.dataProviderService.getQuotes({ - items: assetProfileIdentifiers, - useCache: false - }); - - const data: Prisma.MarketDataUpdateInput[] = []; - - for (const { dataSource, symbol } of assetProfileIdentifiers) { - const quote = quotes[symbol]; - - if (quote?.dataSource !== dataSource || !quote.marketPrice) { - continue; - } - - data.push({ - dataSource, - date, - symbol, - marketPrice: quote.marketPrice, - state: 'INTRADAY' - }); - } - - await this.marketDataService.updateMany({ data }); - } catch (error) { - this.logger.error('Could not gather hourly market data', error); - } - } - public async gatherAssetProfiles( aAssetProfileIdentifiers?: AssetProfileIdentifier[] ) { @@ -322,6 +282,46 @@ export class DataGatheringService { } } + public async gatherHourlySymbols() { + const assetProfileIdentifiers = + await this.getHourlyAssetProfileIdentifiers(); + + if (assetProfileIdentifiers.length <= 0) { + return; + } + + const date = getStartOfUtcDate(new Date()); + + try { + const quotes = await this.dataProviderService.getQuotes({ + items: assetProfileIdentifiers, + useCache: false + }); + + const data: Prisma.MarketDataUpdateInput[] = []; + + for (const { dataSource, symbol } of assetProfileIdentifiers) { + const quote = quotes[symbol]; + + if (quote?.dataSource !== dataSource || !quote.marketPrice) { + continue; + } + + data.push({ + dataSource, + date, + symbol, + marketPrice: quote.marketPrice, + state: 'INTRADAY' + }); + } + + await this.marketDataService.updateMany({ data }); + } catch (error) { + this.logger.error('Could not gather hourly market data', error); + } + } + public async gatherSymbols({ dataGatheringItems, force = false,