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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
14 additions and
6 deletions
-
CHANGELOG.md
-
apps/api/src/helper/country.helper.ts
-
apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
-
apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts
|
|
|
@ -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` |
|
|
|
|
|
|
|
|
|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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> = { |
|
|
|
|
|
|
|
@ -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); |
|
|
|
|