diff --git a/CHANGELOG.md b/CHANGELOG.md index 04467e0f5..bf2fb488b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Harmonized the icons and labels in the access table to share the portfolio - Migrated the create and edit access dialogs to dedicated routes +- Improved the response of the historical market data gathering endpoint for a specific date - Introduced a timeout for the asset profile and the historical market data gathering jobs - Reduced the number of attempts of the asset profile and the historical market data gathering jobs ### Fixed +- Fixed the country mapping of Macau in the _Financial Modeling Prep_ service - Fixed the asset profile and historical market data gathering of a symbol getting blocked permanently by a failed job by discarding the failed jobs - Fixed the asset profile data gathering of a symbol in the admin control panel by removing an existing job before enqueueing a new one diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index 7ee99bf41..413f1865b 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -218,11 +218,20 @@ export class AdminController { ); } - return this.dataGatheringService.gatherSymbolForDate({ + const marketData = await this.dataGatheringService.gatherSymbolForDate({ dataSource, date, symbol }); + + if (!marketData) { + throw new HttpException( + getReasonPhrase(StatusCodes.NOT_FOUND), + StatusCodes.NOT_FOUND + ); + } + + return marketData; } @HasPermission(permissions.accessAdminControl) diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts index c768de070..648ec5fe1 100644 --- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts +++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts @@ -56,6 +56,7 @@ export class FinancialModelingPrepService private static countriesMapping = { 'Czech Republic': 'CZ', 'Korea (the Republic of)': 'KR', + Macau: 'MO', 'Russian Federation': 'RU', 'Taiwan (Province of China)': 'TW', Turkey: 'TR' 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 51bf9ef6a..7830d428e 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 @@ -219,5 +219,34 @@ describe('DataGatheringService', () => { }) ); }); + + it('returns the upserted market data', async () => { + dataProviderService.getHistoricalRaw.mockResolvedValue({ + 'YAHOO-AAPL': { + '2026-08-22': { marketPrice: 100 } + } + }); + prismaService.marketData.upsert.mockResolvedValue({ marketPrice: 100 }); + + const marketData = await dataGatheringService.gatherSymbolForDate({ + dataSource: 'YAHOO', + date: parseDate('2026-08-22'), + symbol: 'AAPL' + }); + + expect(marketData).toEqual({ marketPrice: 100 }); + }); + + it('returns undefined if the data provider has no market price', async () => { + dataProviderService.getHistoricalRaw.mockResolvedValue({}); + + const marketData = await dataGatheringService.gatherSymbolForDate({ + dataSource: 'YAHOO', + date: parseDate('2026-08-22'), + symbol: 'AAPL' + }); + + expect(marketData).toBeUndefined(); + }); }); }); 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 aead0f81e..4befe078f 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 @@ -348,10 +348,10 @@ export class DataGatheringService { }); } } catch (error) { - this.logger.error(error.message); - } finally { - return undefined; + this.logger.error(error?.message); } + + return undefined; } public async gatherSymbols({ diff --git a/apps/client/src/app/components/access-table/access-table.component.html b/apps/client/src/app/components/access-table/access-table.component.html index c6e504d6c..15c0794ab 100644 --- a/apps/client/src/app/components/access-table/access-table.component.html +++ b/apps/client/src/app/components/access-table/access-table.component.html @@ -15,7 +15,7 @@ } @else if (element.type === 'PUBLIC') { Public } @else if (element.type === 'MCP') { - MCP + Model Context Protocol (MCP) } @@ -112,10 +112,11 @@ }