|
|
|
@ -1,12 +1,10 @@ |
|
|
|
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; |
|
|
|
import { DataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; |
|
|
|
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; |
|
|
|
import { PropertyService } from '@ghostfolio/api/services/property/property.service'; |
|
|
|
import { |
|
|
|
ghostfolioFearAndGreedIndexDataSourceCryptocurrencies, |
|
|
|
ghostfolioFearAndGreedIndexSymbolCryptocurrencies, |
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks, |
|
|
|
PROPERTY_API_KEY_GHOSTFOLIO |
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
DATE_FORMAT, |
|
|
|
@ -30,8 +28,7 @@ export class SymbolService { |
|
|
|
|
|
|
|
public constructor( |
|
|
|
private readonly dataProviderService: DataProviderService, |
|
|
|
private readonly marketDataService: MarketDataService, |
|
|
|
private readonly propertyService: PropertyService |
|
|
|
private readonly marketDataService: MarketDataService |
|
|
|
) {} |
|
|
|
|
|
|
|
public async get({ |
|
|
|
@ -136,12 +133,7 @@ export class SymbolService { |
|
|
|
}: { |
|
|
|
includeHistoricalData: number; |
|
|
|
}): Promise<MarketDataOfMarketsResponse> { |
|
|
|
const hasApiKeyForDataProviderGhostfolio = |
|
|
|
!!(await this.propertyService.getByKey<string>( |
|
|
|
PROPERTY_API_KEY_GHOSTFOLIO |
|
|
|
)); |
|
|
|
|
|
|
|
if (hasApiKeyForDataProviderGhostfolio) { |
|
|
|
if (await this.dataProviderService.isDataProviderGhostfolioConfigured()) { |
|
|
|
return this.dataProviderService.getMarketDataOfMarkets({ |
|
|
|
includeHistoricalData |
|
|
|
}); |
|
|
|
|