Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix currency inconsistency with usx (#1094)
Thomas Kaul71c7e37b5a99
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 67a88add2d..5a9103aeda 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Fixed++- Fixed an issue with the currency inconsistency in the _Yahoo Finance_ service (convert from `USX` to `USD`)+## 1.172.0 - 23.07.2022### Addeddiff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.tsindex 34556b061f..bddd529c2b 100644--- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts+++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts@@ -266,6 +266,16 @@ export class YahooFinanceService implements DataProviderInterface {}}+ if (yahooFinanceSymbols.includes('USDUSX=X')) {+ // Convert USD to USX (cent)+ response['USDUSX'] = {+ currency: 'USX',+ dataSource: this.getName(),+ marketPrice: new Big(1).mul(100).toNumber(),+ marketState: 'open'+ };+ }+return response;} catch (error) {Logger.error(error, 'YahooFinanceService');diff --git a/apps/api/src/services/exchange-rate-data.service.ts b/apps/api/src/services/exchange-rate-data.service.tsindex eb4c84599f..25ccc73b80 100644--- a/apps/api/src/services/exchange-rate-data.service.ts+++ b/apps/api/src/services/exchange-rate-data.service.ts@@ -122,15 +122,6 @@ export class ExchangeRateDataService {return 0;}- const hasNaN = Object.values(this.exchangeRates).some((exchangeRate) => {- return isNaN(exchangeRate);- });-- if (hasNaN) {- // Reinitialize if data is not loaded correctly- this.initialize();- }-let factor = 1;if (aFromCurrency !== aToCurrency) {