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 78644726..d876b42c 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 @@ -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); diff --git a/test/import/invalid-symbol-btc-usd.csv b/test/import/invalid-symbol-btc-usd.csv new file mode 100644 index 00000000..d2c91be7 --- /dev/null +++ b/test/import/invalid-symbol-btc-usd.csv @@ -0,0 +1,2 @@ +Date,Code,Currency,Price,Quantity,Action,Fee +12/12/2021,BTC-USD,USD,44558.42,1,buy,0 diff --git a/test/import/ok-btcusd.csv b/test/import/ok-btcusd.csv new file mode 100644 index 00000000..8cddc127 --- /dev/null +++ b/test/import/ok-btcusd.csv @@ -0,0 +1,2 @@ +Date,Code,Currency,Price,Quantity,Action,Fee +12/12/2021,BTCUSD,USD,44558.42,1,buy,0