Feature/add cryptocurrency solana (#563)
* Add support for Solana and clean up symbol conversion (SOL1USD) * Update changelog
This commit is contained in:
parent
1602f976f0
commit
9f545e3e2b
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for cryptocurrency _Solana_ (`SOL-USD`)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Converted errors to warnings in portfolio calculator
|
||||
|
@ -4,5 +4,6 @@
|
||||
"AVAX": "Avalanche",
|
||||
"MATIC": "Polygon",
|
||||
"SHIB": "Shiba Inu",
|
||||
"SOL": "Solana",
|
||||
"UNI3": "Uniswap"
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ jest.mock(
|
||||
return true;
|
||||
case 'DOGEUSD':
|
||||
return true;
|
||||
case 'SOLUSD':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -55,9 +53,6 @@ describe('YahooFinanceService', () => {
|
||||
expect(
|
||||
await yahooFinanceService.convertToYahooFinanceSymbol('DOGEUSD')
|
||||
).toEqual('DOGE-USD');
|
||||
expect(
|
||||
await yahooFinanceService.convertToYahooFinanceSymbol('SOL1USD')
|
||||
).toEqual('SOL1-USD');
|
||||
expect(
|
||||
await yahooFinanceService.convertToYahooFinanceSymbol('USDCHF')
|
||||
).toEqual('USDCHF=X');
|
||||
|
@ -49,7 +49,6 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
* Currency: USDCHF -> USDCHF=X
|
||||
* Cryptocurrency: BTCUSD -> BTC-USD
|
||||
* DOGEUSD -> DOGE-USD
|
||||
* SOL1USD -> SOL1-USD
|
||||
*/
|
||||
public convertToYahooFinanceSymbol(aSymbol: string) {
|
||||
if (aSymbol.includes(baseCurrency) && aSymbol.length >= 6) {
|
||||
@ -57,9 +56,7 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
return `${aSymbol}=X`;
|
||||
} else if (
|
||||
this.cryptocurrencyService.isCryptocurrency(
|
||||
aSymbol
|
||||
.replace(new RegExp(`-${baseCurrency}$`), baseCurrency)
|
||||
.replace('1', '')
|
||||
aSymbol.replace(new RegExp(`-${baseCurrency}$`), baseCurrency)
|
||||
)
|
||||
) {
|
||||
// Add a dash before the last three characters
|
||||
@ -246,9 +243,7 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
return (
|
||||
(quoteType === 'CRYPTOCURRENCY' &&
|
||||
this.cryptocurrencyService.isCryptocurrency(
|
||||
symbol
|
||||
.replace(new RegExp(`-${baseCurrency}$`), baseCurrency)
|
||||
.replace('1', '')
|
||||
symbol.replace(new RegExp(`-${baseCurrency}$`), baseCurrency)
|
||||
)) ||
|
||||
quoteType === 'EQUITY' ||
|
||||
quoteType === 'ETF'
|
||||
|
Loading…
x
Reference in New Issue
Block a user