Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/improve symbol conversion in eod historical data service (#2457)

Thomas Kaul45f385a4836a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9333530bc8..b021bcc8df 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 307f6127a8..ac2f35c04e 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`;
}
}