Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Convert between ZAc and ZAR (#1471)
Delena Malan6a764fe893d0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9bb08f79c0..50b40d4bb8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -39,6 +39,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Added an indicator for excluded accounts in the accounts table- Added a blog post: _Black Friday 2022_+### Fixed++- Fixed an issue with the currency inconsistency in the _Yahoo Finance_ service (convert from `ZAc` to `ZAR`)+## 1.212.0 - 11.11.2022### Changeddiff --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 64d318ac8d..01dcf79a1a 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@@ -206,6 +206,9 @@ export class YahooFinanceService implements DataProviderInterface {} else if (symbol === `${this.baseCurrency}ILA`) {// Convert ILS to ILAmarketPrice = new Big(marketPrice).mul(100).toNumber();+ } else if (symbol === `${this.baseCurrency}ZAc`) {+ // Convert ZAR to ZAc (cents)+ marketPrice = new Big(marketPrice).mul(100).toNumber();}response[symbol][format(historicalItem.date, DATE_FORMAT)] = {@@ -287,6 +290,18 @@ export class YahooFinanceService implements DataProviderInterface {.mul(100).toNumber()};+ } else if (+ symbol === `${this.baseCurrency}ZAR` &&+ yahooFinanceSymbols.includes(`${this.baseCurrency}ZAc=X`)+ ) {+ // Convert ZAR to ZAc (cents)+ response[`${this.baseCurrency}ZAc`] = {+ ...response[symbol],+ currency: 'ZAc',+ marketPrice: new Big(response[symbol].marketPrice)+ .mul(100)+ .toNumber()+ };}}