Browse Source

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

* Improve currency detection

* Extend tests

* Update changelog
pull/5251/head
Thomas Kaul 2 weeks ago
committed by GitHub
parent
commit
51f067e454
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 20
      apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts
  3. 3
      apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts

1
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

20
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'

3
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 (

Loading…
Cancel
Save