diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac273b7a..9def6ab50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the usability of the user account registration - Improved the usability of the _Copy AI prompt to clipboard_ actions on the analysis page (experimental) +- Formatted the name in the _Financial Modeling Prep_ service - Removed the exchange rates from the overview of the admin control panel - Improved the language localization for German (`de`) - Upgraded `angular` from version `19.0.5` to `19.2.1` 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 5216ed214..119e8ea67 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 @@ -12,6 +12,7 @@ import { IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; +import { REPLACE_NAME_PARTS } from '@ghostfolio/common/config'; import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper'; import { DataProviderInfo, @@ -186,7 +187,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { response.isin = assetProfile.isin; } - response.name = assetProfile.companyName; + response.name = this.formatName({ name: assetProfile.companyName }); if (assetProfile.website) { response.url = assetProfile.website; @@ -398,7 +399,7 @@ export class FinancialModelingPrepService implements DataProviderInterface { assetSubClass: undefined, // TODO dataProviderInfo: this.getDataProviderInfo(), dataSource: this.getName(), - name: companyName + name: this.formatName({ name: companyName }) }; }); } else { @@ -414,12 +415,12 @@ export class FinancialModelingPrepService implements DataProviderInterface { items = result.map(({ currency, name, symbol }) => { return { currency, - name, symbol, assetClass: undefined, // TODO assetSubClass: undefined, // TODO dataProviderInfo: this.getDataProviderInfo(), - dataSource: this.getName() + dataSource: this.getName(), + name: this.formatName({ name }) }; }); } @@ -438,6 +439,18 @@ export class FinancialModelingPrepService implements DataProviderInterface { return { items }; } + private formatName({ name }: { name: string }) { + if (name) { + for (const part of REPLACE_NAME_PARTS) { + name = name.replace(part, ''); + } + + name = name.trim(); + } + + return name; + } + private getUrl({ version }: { version: number }) { return `https://financialmodelingprep.com/api/v${version}`; }