Browse Source

Respect includeIndices in search()

pull/5746/head
Thomas Kaul 3 weeks ago
parent
commit
ee2eb7b176
  1. 31
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

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

@ -438,6 +438,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {
}
public async search({
includeIndices = false,
query,
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
}: GetSearchParams): Promise<LookupResponse> {
@ -484,17 +485,25 @@ export class FinancialModelingPrepService implements DataProviderInterface {
}
).then((res) => res.json());
items = result.map(({ currency, name, symbol }) => {
return {
currency,
symbol,
assetClass: undefined, // TODO
assetSubClass: undefined, // TODO
dataProviderInfo: this.getDataProviderInfo(),
dataSource: this.getName(),
name: this.formatName({ name })
};
});
items = result
.filter(({ symbol }) => {
if (includeIndices === false && symbol.startsWith('^')) {
return false;
}
return true;
})
.map(({ currency, name, symbol }) => {
return {
currency,
symbol,
assetClass: undefined, // TODO
assetSubClass: undefined, // TODO
dataProviderInfo: this.getDataProviderInfo(),
dataSource: this.getName(),
name: this.formatName({ name })
};
});
}
} catch (error) {
let message = error;

Loading…
Cancel
Save