From 440dc470fafc5c6514482b54a17f48d4599a70c9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:22:03 +0100 Subject: [PATCH] Bugfix/fix currency inconsistency with conversion of ZAR to ZAc (#2869) * Fix conversion from ZAR to ZAc * Update changelog --- CHANGELOG.md | 1 + .../eod-historical-data.service.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3691a51f1..b5a637552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the currency in the error log of the exchange rate data service +- Fixed an issue with the currency inconsistency in the _EOD Historical Data_ service (convert from `ZAR` to `ZAc`) ## 2.38.0 - 2024-01-13 diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index 76e8ce9c6..24607ab4d 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -235,6 +235,17 @@ export class EodHistoricalDataService implements DataProviderInterface { }; } + if (response[`${DEFAULT_CURRENCY}ZAR`]) { + response[`${DEFAULT_CURRENCY}ZAc`] = { + ...response[`${DEFAULT_CURRENCY}ZAR`], + currency: 'ZAc', + marketPrice: this.getConvertedValue({ + symbol: `${DEFAULT_CURRENCY}ZAc`, + value: response[`${DEFAULT_CURRENCY}ZAR`].marketPrice + }) + }; + } + return response; } catch (error) { let message = error; @@ -350,6 +361,9 @@ export class EodHistoricalDataService implements DataProviderInterface { } else if (symbol === `${DEFAULT_CURRENCY}ILA`) { // Convert ILS to ILA return new Big(value).mul(100).toNumber(); + } else if (symbol === `${DEFAULT_CURRENCY}ZAc`) { + // Convert ZAR to ZAc + return new Big(value).mul(100).toNumber(); } return value;