Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/add missing country mapping for Czech Republic and Turkey (#7611)
Thomas Kaulb764faff9e41
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c805c2586d..53235aaf45 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Resolved an error when fetching dividends from _Yahoo Finance_ for date ranges without events+### Fixed++- Fixed the missing mapping for Turkey in the country weightings of the _Financial Modeling Prep_ service+- Fixed the missing mapping for Czech Republic and Turkey in the data enhancer for asset profile data via _Yahoo Finance_+## 3.49.0 - 2026-08-12### Changeddiff --git a/apps/api/src/helper/country.helper.ts b/apps/api/src/helper/country.helper.tsindex ecb28b8d3c..2e6da5340f 100644--- a/apps/api/src/helper/country.helper.ts+++ b/apps/api/src/helper/country.helper.ts@@ -18,7 +18,7 @@ export function getCountryCodeByName({}}- if (name) {+ if (name && name.toLowerCase() !== 'other') {const logger = new Logger('getCountryCodeByName');logger.warn(`Could not map the country "${name}" to a code`);diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.tsindex 749f10c127..f2cbcf8eaf 100644--- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts+++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts@@ -1,3 +1,4 @@+import { getCountryCodeByName } from '@ghostfolio/api/helper/country.helper';import { getSectorName } from '@ghostfolio/api/helper/sector.helper';import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/errors/asset-profile-delisted.error';@@ -18,12 +19,16 @@ import {SymbolProfile} from '@prisma/client';import { isISIN } from 'class-validator';-import { countries } from 'countries-list';import YahooFinance from 'yahoo-finance2';import type { Price } from 'yahoo-finance2/esm/src/modules/quoteSummary-iface';@Injectable()export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {+ private static countriesMapping = {+ 'Czech Republic': 'CZ',+ Turkey: 'TR'+ };+private static sectorsMapping: Record<string, SectorName> = {basic_materials: 'Basic Materials',communication_services: 'Communication Services',@@ -246,15 +251,14 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {) {// Add country if asset is stock and country available- try {- const [code] = Object.entries(countries).find(([, country]) => {- return country.name === assetProfile.summaryProfile?.country;- });+ const code = getCountryCodeByName({+ aliases: YahooFinanceDataEnhancerService.countriesMapping,+ name: assetProfile.summaryProfile.country+ });- if (code) {- response.countries = [{ code, weight: 1 }];- }- } catch {}+ if (code) {+ response.countries = [{ code, weight: 1 }];+ }if (assetProfile.summaryProfile?.sector) {response.sectors = [diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.tsindex f4c36d2567..913214b417 100644--- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts+++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts@@ -56,7 +56,8 @@ export class FinancialModelingPrepServiceprivate static countriesMapping = {'Korea (the Republic of)': 'KR','Russian Federation': 'RU',- 'Taiwan (Province of China)': 'TW'+ 'Taiwan (Province of China)': 'TW',+ Turkey: 'TR'};private readonly logger = new Logger(FinancialModelingPrepService.name);