Browse Source

Bugfix/fix currency inconsistency with conversion of ZAR to ZAc (#2869)

* Fix conversion from ZAR to ZAc

* Update changelog
pull/2871/head
Thomas Kaul 1 year ago
committed by GitHub
parent
commit
440dc470fa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 14
      apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed the currency in the error log of the exchange rate data service - 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 ## 2.38.0 - 2024-01-13

14
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; return response;
} catch (error) { } catch (error) {
let message = error; let message = error;
@ -350,6 +361,9 @@ export class EodHistoricalDataService implements DataProviderInterface {
} else if (symbol === `${DEFAULT_CURRENCY}ILA`) { } else if (symbol === `${DEFAULT_CURRENCY}ILA`) {
// Convert ILS to ILA // Convert ILS to ILA
return new Big(value).mul(100).toNumber(); 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; return value;

Loading…
Cancel
Save