Feature/format name in eod historical data service (#2922)
* Format name * Update changelog
This commit is contained in:
parent
50fb82a6e6
commit
8f5f4c5875
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Formatted the name in the _EOD Historical Data_ service
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
||||||
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
|
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
|
||||||
import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface';
|
import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface';
|
||||||
import { DEFAULT_CURRENCY, UNKNOWN_KEY } from '@ghostfolio/common/config';
|
import {
|
||||||
|
DEFAULT_CURRENCY,
|
||||||
|
REPLACE_NAME_PARTS,
|
||||||
|
UNKNOWN_KEY
|
||||||
|
} from '@ghostfolio/common/config';
|
||||||
import { isCurrency } from '@ghostfolio/common/helper';
|
import { isCurrency } from '@ghostfolio/common/helper';
|
||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
@ -137,18 +141,11 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
|
|||||||
if (name) {
|
if (name) {
|
||||||
name = name.replace('&', '&');
|
name = name.replace('&', '&');
|
||||||
|
|
||||||
name = name.replace('Amundi Index Solutions - ', '');
|
for (const part of REPLACE_NAME_PARTS) {
|
||||||
name = name.replace('iShares ETF (CH) - ', '');
|
name = name.replace(part, '');
|
||||||
name = name.replace('iShares III Public Limited Company - ', '');
|
}
|
||||||
name = name.replace('iShares V PLC - ', '');
|
|
||||||
name = name.replace('iShares VI Public Limited Company - ', '');
|
name = name.trim();
|
||||||
name = name.replace('iShares VII PLC - ', '');
|
|
||||||
name = name.replace('Multi Units Luxembourg - ', '');
|
|
||||||
name = name.replace('VanEck ETFs N.V. - ', '');
|
|
||||||
name = name.replace('Vaneck Vectors Ucits Etfs Plc - ', '');
|
|
||||||
name = name.replace('Vanguard Funds Public Limited Company - ', '');
|
|
||||||
name = name.replace('Vanguard Index Funds - ', '');
|
|
||||||
name = name.replace('Xtrackers (IE) Plc - ', '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quoteType === 'FUTURE') {
|
if (quoteType === 'FUTURE') {
|
||||||
|
@ -11,7 +11,10 @@ import {
|
|||||||
IDataProviderHistoricalResponse,
|
IDataProviderHistoricalResponse,
|
||||||
IDataProviderResponse
|
IDataProviderResponse
|
||||||
} from '@ghostfolio/api/services/interfaces/interfaces';
|
} from '@ghostfolio/api/services/interfaces/interfaces';
|
||||||
import { DEFAULT_CURRENCY } from '@ghostfolio/common/config';
|
import {
|
||||||
|
DEFAULT_CURRENCY,
|
||||||
|
REPLACE_NAME_PARTS
|
||||||
|
} from '@ghostfolio/common/config';
|
||||||
import { DATE_FORMAT, isCurrency } from '@ghostfolio/common/helper';
|
import { DATE_FORMAT, isCurrency } from '@ghostfolio/common/helper';
|
||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
@ -362,6 +365,18 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
return aSymbol;
|
return aSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private formatName({ name }: { name: string }) {
|
||||||
|
if (name) {
|
||||||
|
for (const part of REPLACE_NAME_PARTS) {
|
||||||
|
name = name.replace(part, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
name = name.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
private async getSearchResult(aQuery: string): Promise<
|
private async getSearchResult(aQuery: string): Promise<
|
||||||
(LookupItem & {
|
(LookupItem & {
|
||||||
assetClass: AssetClass;
|
assetClass: AssetClass;
|
||||||
@ -397,9 +412,9 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
assetClass,
|
assetClass,
|
||||||
assetSubClass,
|
assetSubClass,
|
||||||
isin,
|
isin,
|
||||||
name,
|
|
||||||
currency: this.convertCurrency(Currency),
|
currency: this.convertCurrency(Currency),
|
||||||
dataSource: this.getName(),
|
dataSource: this.getName(),
|
||||||
|
name: this.formatName({ name }),
|
||||||
symbol: `${Code}.${Exchange}`
|
symbol: `${Code}.${Exchange}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,21 @@ export const QUEUE_JOB_STATUS_LIST = <JobStatus[]>[
|
|||||||
'waiting'
|
'waiting'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const REPLACE_NAME_PARTS = [
|
||||||
|
'Amundi Index Solutions -',
|
||||||
|
'iShares ETF (CH) -',
|
||||||
|
'iShares III Public Limited Company -',
|
||||||
|
'iShares V PLC -',
|
||||||
|
'iShares VI Public Limited Company -',
|
||||||
|
'iShares VII PLC -',
|
||||||
|
'Multi Units Luxembourg -',
|
||||||
|
'VanEck ETFs N.V. -',
|
||||||
|
'Vaneck Vectors Ucits Etfs Plc -',
|
||||||
|
'Vanguard Funds Public Limited Company -',
|
||||||
|
'Vanguard Index Funds -',
|
||||||
|
'Xtrackers (IE) Plc -'
|
||||||
|
];
|
||||||
|
|
||||||
export const SUPPORTED_LANGUAGE_CODES = [
|
export const SUPPORTED_LANGUAGE_CODES = [
|
||||||
'de',
|
'de',
|
||||||
'en',
|
'en',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user