Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/improve search by name in FMP service (#6012)

Thomas Kaulf796ea628edb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c4cf9b41b9..4bcea795c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Improved the country weightings in the _Financial Modeling Prep_ service
+- Improved the search functionality by name in the _Financial Modeling Prep_ service
## 2.220.0 - 2025-11-29
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 27f462c902..2b4193af53 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
@@ -41,6 +41,7 @@ import {
isSameDay,
parseISO
} from 'date-fns';
+import { uniqBy } from 'lodash';
@Injectable()
export class FinancialModelingPrepService implements DataProviderInterface {
@@ -549,14 +550,27 @@ export class FinancialModelingPrepService implements DataProviderInterface {
apikey: this.apiKey
});
- const result = await fetch(
- `${this.getUrl({ version: 'stable' })}/search-symbol?${queryParams.toString()}`,
- {
- signal: AbortSignal.timeout(
- this.configurationService.get('REQUEST_TIMEOUT')
- )
+ const [nameResults, symbolResults] = await Promise.all([
+ fetch(
+ `${this.getUrl({ version: 'stable' })}/search-name?${queryParams.toString()}`,
+ {
+ signal: AbortSignal.timeout(requestTimeout)
+ }
+ ).then((res) => res.json()),
+ fetch(
+ `${this.getUrl({ version: 'stable' })}/search-symbol?${queryParams.toString()}`,
+ {
+ signal: AbortSignal.timeout(requestTimeout)
+ }
+ ).then((res) => res.json())
+ ]);
+
+ const result = uniqBy(
+ [...nameResults, ...symbolResults],
+ ({ exchange, symbol }) => {
+ return `${exchange}-${symbol}`;
}
- ).then((res) => res.json());
+ );
items = result
.filter(({ exchange, symbol }) => {