Browse Source

Add missing country mapping for Macau

pull/7651/head
Thomas Kaul 21 hours ago
parent
commit
c61589b157
  1. 8
      apps/api/src/helper/country.helper.ts
  2. 4
      apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
  3. 1
      apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
  4. 1
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

8
apps/api/src/helper/country.helper.ts

@ -3,9 +3,11 @@ import { countries } from 'countries-list';
export function getCountryCodeByName({ export function getCountryCodeByName({
aliases = {}, aliases = {},
dataSource,
name name
}: { }: {
aliases?: Record<string, string>; aliases?: Record<string, string>;
dataSource?: string;
name: string; name: string;
}): string { }): string {
if (aliases[name]) { if (aliases[name]) {
@ -21,7 +23,11 @@ export function getCountryCodeByName({
if (name && name.toLowerCase() !== 'other') { if (name && name.toLowerCase() !== 'other') {
const logger = new Logger('getCountryCodeByName'); const logger = new Logger('getCountryCodeByName');
logger.warn(`Could not map the country "${name}" to a code`); logger.warn(
`Could not map the country "${name}" to a code${
dataSource ? ` (${dataSource})` : ''
}`
);
} }
return undefined; return undefined;

4
apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts

@ -17,6 +17,7 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
private static countriesMapping = { private static countriesMapping = {
'Czech Republic': 'CZ', 'Czech Republic': 'CZ',
Macau: 'MO',
'Republic of Korea': 'KR', 'Republic of Korea': 'KR',
'Russian Federation': 'RU', 'Russian Federation': 'RU',
Turkey: 'TR', Turkey: 'TR',
@ -128,7 +129,8 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
)) { )) {
const code = getCountryCodeByName({ const code = getCountryCodeByName({
name, name,
aliases: TrackinsightDataEnhancerService.countriesMapping aliases: TrackinsightDataEnhancerService.countriesMapping,
dataSource: this.getName()
}); });
if (code) { if (code) {

1
apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts

@ -254,6 +254,7 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
const code = getCountryCodeByName({ const code = getCountryCodeByName({
aliases: YahooFinanceDataEnhancerService.countriesMapping, aliases: YahooFinanceDataEnhancerService.countriesMapping,
dataSource: this.getName(),
name: assetProfile.summaryProfile.country name: assetProfile.summaryProfile.country
}); });

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

@ -175,6 +175,7 @@ export class FinancialModelingPrepService
return { return {
code: getCountryCodeByName({ code: getCountryCodeByName({
aliases: FinancialModelingPrepService.countriesMapping, aliases: FinancialModelingPrepService.countriesMapping,
dataSource: this.getName(),
name: countryName name: countryName
}), }),
weight: parseFloat(`${weightPercentage}`) / 100 weight: parseFloat(`${weightPercentage}`) / 100

Loading…
Cancel
Save