From 6bdfd8984ff9614a1d452a14bc39b27a669defe1 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 9 Mar 2025 12:28:33 +0100 Subject: [PATCH] Bugfix/fix fetching dividend and historical market data in Financial Modeling Prep service (#4416) * Add default values * Update changelog --- CHANGELOG.md | 2 ++ .../financial-modeling-prep.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f153f2831..579536ef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue to get dividends in the _Financial Modeling Prep_ service +- Fixed an issue to get historical market data in the _Financial Modeling Prep_ service - Fixed an issue with serving _Storybook_ ## 2.144.0 - 2025-03-06 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 2d42fe21c..6a3d0d41f 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 @@ -244,7 +244,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { [date: string]: IDataProviderHistoricalResponse; } = {}; - const { historical } = await fetch( + const { historical = [] } = await fetch( `${this.URL}/historical-price-full/stock_dividend/${symbol}?apikey=${this.apiKey}`, { signal: AbortSignal.timeout(requestTimeout) @@ -305,7 +305,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { ? addYears(currentFrom, MAX_YEARS_PER_REQUEST) : to; - const { historical } = await fetch( + const { historical = [] } = await fetch( `${this.URL}/historical-price-full/${symbol}?apikey=${this.apiKey}&from=${format(currentFrom, DATE_FORMAT)}&to=${format(currentTo, DATE_FORMAT)}`, { signal: AbortSignal.timeout(requestTimeout)