Browse Source

Resolve error when fetching dividends for date ranges without events

pull/7612/head
Thomas Kaul 2 weeks ago
parent
commit
9547051207
  1. 9
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

9
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

@ -136,10 +136,6 @@ export class YahooFinanceService implements DataProviderInterface {
}: GetHistoricalParams): Promise<{ }: GetHistoricalParams): Promise<{
[date: string]: DataProviderHistoricalResponse; [date: string]: DataProviderHistoricalResponse;
}> { }> {
if (isSameDay(from, to)) {
to = addDays(to, 1);
}
try { try {
const historicalResult = this.convertToHistoricalResult( const historicalResult = this.convertToHistoricalResult(
await this.yahooFinance.chart( await this.yahooFinance.chart(
@ -149,7 +145,10 @@ export class YahooFinanceService implements DataProviderInterface {
{ {
interval: '1d', interval: '1d',
period1: format(from, DATE_FORMAT), period1: format(from, DATE_FORMAT),
period2: format(to, DATE_FORMAT) period2: format(
isSameDay(from, to) ? addDays(to, 1) : to,
DATE_FORMAT
)
} }
) )
); );

Loading…
Cancel
Save