Skip to content

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

Bugfix/fix issue with currency detection in Yahoo Finance service (#5250)

Thomas Kaul51f067e45464
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d297464662..7e2fadb83d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the date format of the retirement date in the _FIRE_ calculator
- Fixed an issue with the permissions of the impersonation mode related to the onboarding on the overview tab of the home page
- Fixed an issue with the permissions of the impersonation mode related to the manage activities button of the holdings tab on the home page
+- Fixed an issue with the currency detection related to `USD.AX` in the _Yahoo Finance_ service
## 2.184.0 - 2025-07-22
diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts
index 8a8ab1f088..c37a9fe3e8 100644
--- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts
+++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts
@@ -47,11 +47,21 @@ describe('YahooFinanceDataEnhancerService', () => {
'BTC-USD'
)
).toEqual('BTCUSD');
+ expect(
+ await yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol(
+ 'USD.AX'
+ )
+ ).toEqual('USD.AX');
expect(
await yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol(
'EURUSD=X'
)
).toEqual('EURUSD');
+ expect(
+ await yahooFinanceDataEnhancerService.convertFromYahooFinanceSymbol(
+ 'USDCHF=X'
+ )
+ ).toEqual('USDCHF');
});
it('convertToYahooFinanceSymbol', async () => {
@@ -65,6 +75,16 @@ describe('YahooFinanceDataEnhancerService', () => {
'DOGEUSD'
)
).toEqual('DOGE-USD');
+ expect(
+ await yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol(
+ 'EURUSD'
+ )
+ ).toEqual('EURUSD=X');
+ expect(
+ await yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol(
+ 'USD.AX'
+ )
+ ).toEqual('USD.AX');
expect(
await yahooFinanceDataEnhancerService.convertToYahooFinanceSymbol(
'USDCHF'
diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
index 8b76ae86ba..54167bc5b3 100644
--- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
+++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
@@ -63,7 +63,8 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
if (
isCurrency(
aSymbol.substring(0, aSymbol.length - DEFAULT_CURRENCY.length)
- )
+ ) &&
+ isCurrency(aSymbol.substring(aSymbol.length - DEFAULT_CURRENCY.length))
) {
return `${aSymbol}=X`;
} else if (