Bugfix/fix symbol validation in Yahoo Finance service (#4472)

* Fix symbol validation

* Add test cases
This commit is contained in:
Thomas Kaul 2025-03-22 17:52:16 +01:00 committed by GitHub
parent a6952a0e37
commit c467c946d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -170,7 +170,7 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
symbol = quotes[0].symbol;
}
} catch {}
} else if (symbol?.includes('-')) {
} else if (symbol?.endsWith(`-${DEFAULT_CURRENCY}`)) {
throw new Error(`${symbol} is not valid`);
} else {
symbol = this.convertToYahooFinanceSymbol(symbol);

View File

@ -0,0 +1,2 @@
Date,Code,Currency,Price,Quantity,Action,Fee
12/12/2021,BTC-USD,USD,44558.42,1,buy,0
1 Date Code Currency Price Quantity Action Fee
2 12/12/2021 BTC-USD USD 44558.42 1 buy 0

View File

@ -0,0 +1,2 @@
Date,Code,Currency,Price,Quantity,Action,Fee
12/12/2021,BTCUSD,USD,44558.42,1,buy,0
1 Date Code Currency Price Quantity Action Fee
2 12/12/2021 BTCUSD USD 44558.42 1 buy 0