Browse Source

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

* Improve search by name

* Update changelog
pull/6021/head^2
Thomas Kaul 12 hours ago
committed by GitHub
parent
commit
f796ea628e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 24
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

1
CHANGELOG.md

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Improved the country weightings in the _Financial Modeling Prep_ service - 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 ## 2.220.0 - 2025-11-29

24
apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

@ -41,6 +41,7 @@ import {
isSameDay, isSameDay,
parseISO parseISO
} from 'date-fns'; } from 'date-fns';
import { uniqBy } from 'lodash';
@Injectable() @Injectable()
export class FinancialModelingPrepService implements DataProviderInterface { export class FinancialModelingPrepService implements DataProviderInterface {
@ -549,14 +550,27 @@ export class FinancialModelingPrepService implements DataProviderInterface {
apikey: this.apiKey apikey: this.apiKey
}); });
const result = await fetch( 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()}`, `${this.getUrl({ version: 'stable' })}/search-symbol?${queryParams.toString()}`,
{ {
signal: AbortSignal.timeout( signal: AbortSignal.timeout(requestTimeout)
this.configurationService.get('REQUEST_TIMEOUT')
)
} }
).then((res) => res.json()); ).then((res) => res.json())
]);
const result = uniqBy(
[...nameResults, ...symbolResults],
({ exchange, symbol }) => {
return `${exchange}-${symbol}`;
}
);
items = result items = result
.filter(({ exchange, symbol }) => { .filter(({ exchange, symbol }) => {

Loading…
Cancel
Save