From 9547051207c23a9faeaada0fecbc9b530c5a0b6e Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 13 Aug 2026 10:50:24 +0200 Subject: [PATCH] Resolve error when fetching dividends for date ranges without events --- .../data-provider/yahoo-finance/yahoo-finance.service.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts index a742c21f3..25d589bbe 100644 --- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts @@ -136,10 +136,6 @@ export class YahooFinanceService implements DataProviderInterface { }: GetHistoricalParams): Promise<{ [date: string]: DataProviderHistoricalResponse; }> { - if (isSameDay(from, to)) { - to = addDays(to, 1); - } - try { const historicalResult = this.convertToHistoricalResult( await this.yahooFinance.chart( @@ -149,7 +145,10 @@ export class YahooFinanceService implements DataProviderInterface { { interval: '1d', period1: format(from, DATE_FORMAT), - period2: format(to, DATE_FORMAT) + period2: format( + isSameDay(from, to) ? addDays(to, 1) : to, + DATE_FORMAT + ) } ) );