Browse Source

Feature/format name in financial modeling prep service (#4441)

* Format name

* Update changelog
pull/4444/head
Thomas Kaul 5 days ago
committed by GitHub
parent
commit
755ab15755
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 21
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

1
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`

21
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}`;
}

Loading…
Cancel
Save