From f25d4728534f914b43caf4aec7e415d1944d58d3 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:40:06 +0200 Subject: [PATCH] Add MCP tool to get performance --- .../portfolio-table.service.spec.ts | 28 +------------------ .../portfolio-table.service.ts | 22 ++++----------- 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts b/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts index f4e64a9a08..ce92747c40 100644 --- a/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts +++ b/apps/api/src/services/portfolio-table/portfolio-table.service.spec.ts @@ -159,14 +159,12 @@ function createWatchlistItem({ function createPortfolioTableService({ accounts = [], chart = [{ date: '2024-01-01' }], - errors = [], holdings = [], performance = createPerformance(), watchlist = [] }: { accounts?: AccountWithValue[]; chart?: HistoricalDataItem[]; - errors?: PortfolioPerformanceResponse['errors']; holdings?: PortfolioPosition[]; performance?: PortfolioPerformanceResponse['performance']; watchlist?: WatchlistResponse['watchlist']; @@ -182,12 +180,7 @@ function createPortfolioTableService({ const portfolioService = { getAccountsWithAggregations: jest.fn().mockResolvedValue({ accounts }), getDetails: jest.fn().mockResolvedValue({ holdings }), - getPerformance: jest.fn().mockResolvedValue({ - chart, - errors, - performance, - hasErrors: errors.length > 0 - }) + getPerformance: jest.fn().mockResolvedValue({ chart, performance }) } as unknown as PortfolioService; const watchlistService = { @@ -415,25 +408,6 @@ describe('PortfolioTableService', () => { } }); - it('tells the asset profiles of which the market data is delayed', async () => { - const result = await getPerformanceTable({ - errors: [ - { dataSource: DataSource.MANUAL, symbol: 'AAPL' }, - { dataSource: DataSource.YAHOO, symbol: 'AAPL' } - ] - }); - - expect(result).toContain( - 'Market data is delayed for: AAPL (MANUAL), AAPL (YAHOO)' - ); - }); - - it('tells no delay of the market data if there is no error', async () => { - const result = await getPerformanceTable(); - - expect(result).not.toContain('Market data is delayed'); - }); - it('tells that no performance is found if the chart is empty', async () => { const result = await getPerformanceTable({ chart: [] }); diff --git a/apps/api/src/services/portfolio-table/portfolio-table.service.ts b/apps/api/src/services/portfolio-table/portfolio-table.service.ts index b9c87bbb55..a9c4c36121 100644 --- a/apps/api/src/services/portfolio-table/portfolio-table.service.ts +++ b/apps/api/src/services/portfolio-table/portfolio-table.service.ts @@ -458,12 +458,11 @@ export class PortfolioTableService { filters?: Filter[]; userId: string; }) { - const { chart, errors, performance } = - await this.portfolioService.getPerformance({ - dateRange, - filters, - userId - }); + const { chart, performance } = await this.portfolioService.getPerformance({ + dateRange, + filters, + userId + }); const performanceSection = ['## Performance', '']; @@ -475,17 +474,6 @@ export class PortfolioTableService { rows: [performance] }) ); - - if (errors?.length > 0) { - performanceSection.push( - '', - `Market data is delayed for: ${errors - .map(({ dataSource, symbol }) => { - return `${symbol} (${dataSource})`; - }) - .join(', ')}` - ); - } } else { performanceSection.push('No performance found.'); }