parent
e3633aaa30
commit
4e51a973c7
@ -1,3 +1,5 @@
|
|||||||
|
import { DEFAULT_CURRENCY } from '@ghostfolio/common/config';
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
const cryptocurrencies = require('../../assets/cryptocurrencies/cryptocurrencies.json');
|
const cryptocurrencies = require('../../assets/cryptocurrencies/cryptocurrencies.json');
|
||||||
@ -9,7 +11,11 @@ export class CryptocurrencyService {
|
|||||||
|
|
||||||
public isCryptocurrency(aSymbol = '') {
|
public isCryptocurrency(aSymbol = '') {
|
||||||
const cryptocurrencySymbol = aSymbol.substring(0, aSymbol.length - 3);
|
const cryptocurrencySymbol = aSymbol.substring(0, aSymbol.length - 3);
|
||||||
return this.getCryptocurrencies().includes(cryptocurrencySymbol);
|
|
||||||
|
return (
|
||||||
|
aSymbol.endsWith(DEFAULT_CURRENCY) &&
|
||||||
|
this.getCryptocurrencies().includes(cryptocurrencySymbol)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCryptocurrencies() {
|
private getCryptocurrencies() {
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
IDataProviderHistoricalResponse,
|
IDataProviderHistoricalResponse,
|
||||||
IDataProviderResponse
|
IDataProviderResponse
|
||||||
} from '@ghostfolio/api/services/interfaces/interfaces';
|
} from '@ghostfolio/api/services/interfaces/interfaces';
|
||||||
import { DEFAULT_CURRENCY } from '@ghostfolio/common/config';
|
|
||||||
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper';
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper';
|
||||||
import {
|
import {
|
||||||
DataProviderInfo,
|
DataProviderInfo,
|
||||||
@ -66,10 +65,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (
|
if (this.cryptocurrencyService.isCryptocurrency(symbol)) {
|
||||||
symbol.endsWith(DEFAULT_CURRENCY) &&
|
|
||||||
this.cryptocurrencyService.isCryptocurrency(symbol)
|
|
||||||
) {
|
|
||||||
const [quote] = await fetch(
|
const [quote] = await fetch(
|
||||||
`${this.URL}/quote/${symbol}?apikey=${this.apiKey}`,
|
`${this.URL}/quote/${symbol}?apikey=${this.apiKey}`,
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user