Browse Source

Task/improve country mapping for data providers (#7137)

* Improve country mapping

* Update changelog
pull/7135/head^2
Thomas Kaul 4 days ago
committed by GitHub
parent
commit
3c68ce286c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 6
      apps/api/src/helper/country.helper.ts
  3. 7
      apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
  4. 6
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the country mapping for data providers
- Upgraded `bull-board` from version `7.2.1` to `8.0.1`
- Upgraded `prettier` from version `3.8.3` to `3.8.4`

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

@ -7,8 +7,12 @@ export function getCountryCodeByName({
aliases?: Record<string, string>;
name: string;
}): string {
if (aliases[name]) {
return aliases[name];
}
for (const [code, country] of Object.entries(countries)) {
if (country.name === name || country.name === aliases[name]) {
if (country.name === name) {
return code;
}
}

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

@ -15,8 +15,11 @@ import { SymbolProfile } from '@prisma/client';
export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
private static baseUrl = 'https://www.trackinsight.com/data-api';
private static countriesMapping = {
'Russian Federation': 'Russia',
USA: 'United States'
'Republic of Korea': 'KR',
'Russian Federation': 'RU',
Turkey: 'TR',
USA: 'US',
'Virgin Islands, British': 'VG'
};
private static holdingsWeightTreshold = 0.85;
private static sectorsMapping: Record<string, SectorName> = {

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

@ -54,9 +54,9 @@ export class FinancialModelingPrepService
implements DataProviderInterface, OnModuleInit
{
private static countriesMapping = {
'Korea (the Republic of)': 'South Korea',
'Russian Federation': 'Russia',
'Taiwan (Province of China)': 'Taiwan'
'Korea (the Republic of)': 'KR',
'Russian Federation': 'RU',
'Taiwan (Province of China)': 'TW'
};
private readonly logger = new Logger(FinancialModelingPrepService.name);

Loading…
Cancel
Save