Browse Source
Feature/handle currency pair inconsistency in yahoo finance service (#1069)
* Handle occasional currency pair inconsistency: GBP=X instead of USDGBP=X
* Update changelog
pull/1071/head
Thomas Kaul
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
1 deletions
-
CHANGELOG.md
-
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Extended the investment timeline grouped by month |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Handled an occasional currency pair inconsistency in the _Yahoo Finance_ service (`GBP=X` instead of `USDGBP=X`) |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed the content height of the account detail dialog |
|
|
|
|
|
@ -37,10 +37,15 @@ export class YahooFinanceService implements DataProviderInterface { |
|
|
|
} |
|
|
|
|
|
|
|
public convertFromYahooFinanceSymbol(aYahooFinanceSymbol: string) { |
|
|
|
const symbol = aYahooFinanceSymbol.replace( |
|
|
|
let symbol = aYahooFinanceSymbol.replace( |
|
|
|
new RegExp(`-${this.baseCurrency}$`), |
|
|
|
this.baseCurrency |
|
|
|
); |
|
|
|
|
|
|
|
if (symbol.includes('=X') && !symbol.includes(this.baseCurrency)) { |
|
|
|
symbol = `${this.baseCurrency}${symbol}`; |
|
|
|
} |
|
|
|
|
|
|
|
return symbol.replace('=X', ''); |
|
|
|
} |
|
|
|
|
|
|
|