From 45f385a4836ab311c8a1fcf0a5475f7e497d89a2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 9 Oct 2023 20:29:56 +0200 Subject: [PATCH] Feature/improve symbol conversion in eod historical data service (#2457) * Improve conversion of currency symbols * Update changelog --- CHANGELOG.md | 1 + .../eod-historical-data/eod-historical-data.service.ts | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9333530bc..b021bcc8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the display of the results in the search for a holding - Changed the queue jobs view in the admin control panel to an `@angular/material` data table +- Improved the symbol conversion in the _EOD Historical Data_ service ## 2.9.0 - 2023-10-08 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 307f6127a..ac2f35c04 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 @@ -283,7 +283,6 @@ export class EodHistoricalDataService implements DataProviderInterface { if (symbol.endsWith('.FOREX')) { symbol = symbol.replace('GBX', 'GBp'); symbol = symbol.replace('.FOREX', ''); - symbol = `${DEFAULT_CURRENCY}${symbol}`; } return symbol; @@ -292,7 +291,7 @@ export class EodHistoricalDataService implements DataProviderInterface { /** * Converts a symbol to a EOD symbol * - * Currency: USDCHF -> CHF.FOREX + * Currency: USDCHF -> USDCHF.FOREX */ private convertToEodSymbol(aSymbol: string) { if ( @@ -304,9 +303,10 @@ export class EodHistoricalDataService implements DataProviderInterface { aSymbol.substring(0, aSymbol.length - DEFAULT_CURRENCY.length) ) ) { - return `${aSymbol - .replace('GBp', 'GBX') - .replace(DEFAULT_CURRENCY, '')}.FOREX`; + let symbol = aSymbol; + symbol = symbol.replace('GBp', 'GBX'); + + return `${symbol}.FOREX`; } }