From e017d4638aa078eef3f2dce7409dfac479a50ae8 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:07:39 +0200 Subject: [PATCH 1/2] Fix state of market data in historical market data gathering for specific date --- .../data-gathering.service.spec.ts | 22 ++++++++++++++++++- .../data-gathering/data-gathering.service.ts | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.service.spec.ts b/apps/api/src/services/queues/data-gathering/data-gathering.service.spec.ts index 4fc80d3d64..cdd4024a11 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.service.spec.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.service.spec.ts @@ -222,7 +222,27 @@ describe('DataGatheringService', () => { expect(prismaService.marketData.upsert).toHaveBeenCalledWith( expect.objectContaining({ create: expect.objectContaining({ isCarriedForward: false }), - update: { marketPrice: 100, isCarriedForward: false } + update: { marketPrice: 100, isCarriedForward: false, state: 'CLOSE' } + }) + ); + }); + + it('sets the state to CLOSE on a previously intraday market price', async () => { + dataProviderService.getHistoricalRaw.mockResolvedValue({ + 'YAHOO-AAPL': { + '2026-08-22': { marketPrice: 100 } + } + }); + + await dataGatheringService.gatherSymbolForDate({ + dataSource: 'YAHOO', + date: parseDate('2026-08-22'), + symbol: 'AAPL' + }); + + expect(prismaService.marketData.upsert).toHaveBeenCalledWith( + expect.objectContaining({ + update: expect.objectContaining({ state: 'CLOSE' }) }) ); }); 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 1162143421..a91f6a9210 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 @@ -346,7 +346,7 @@ export class DataGatheringService { date: startOfUtcDate, isCarriedForward: false }, - update: { marketPrice, isCarriedForward: false }, + update: { marketPrice, isCarriedForward: false, state: 'CLOSE' }, where: { dataSource_date_symbol: { dataSource, From c5870141529b607ecd18ad180366d9f50e8ca269 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:07:41 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366727022c..b1104ebe01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed the missing thousands separator of 4-digit numbers in certain locales - Fixed an issue where holdings without a market price have been valued at the unit price of a dividend, a fee, an interest or a liability - Fixed the check for today in the current rate service for instances running in a time zone behind UTC +- Fixed the state of the market data in the historical market data gathering endpoint for a specific date ## 3.79.0 - 2026-10-04