Thomas
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
4 additions and
5 deletions
-
apps/api/src/services/data-provider.service.ts
-
apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts
-
apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts
|
|
@ -12,7 +12,6 @@ import { AlphaVantageService } from './data-provider/alpha-vantage/alpha-vantage |
|
|
|
import { GhostfolioScraperApiService } from './data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service'; |
|
|
|
import { RakutenRapidApiService } from './data-provider/rakuten-rapid-api/rakuten-rapid-api.service'; |
|
|
|
import { YahooFinanceService } from './data-provider/yahoo-finance/yahoo-finance.service'; |
|
|
|
import { DataProviderInterface } from './interfaces/data-provider.interface'; |
|
|
|
import { |
|
|
|
IDataGatheringItem, |
|
|
|
IDataProviderHistoricalResponse, |
|
|
@ -21,7 +20,7 @@ import { |
|
|
|
import { PrismaService } from './prisma.service'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class DataProviderService implements DataProviderInterface { |
|
|
|
export class DataProviderService { |
|
|
|
public constructor( |
|
|
|
private readonly alphaVantageService: AlphaVantageService, |
|
|
|
private readonly configurationService: ConfigurationService, |
|
|
@ -155,7 +154,7 @@ export class DataProviderService implements DataProviderInterface { |
|
|
|
|
|
|
|
public async search(aSymbol: string) { |
|
|
|
return this.getDataProvider( |
|
|
|
this.configurationService.get('DATA_SOURCES')[0] |
|
|
|
<DataSource>this.configurationService.get('DATA_SOURCES')[0] |
|
|
|
).search(aSymbol); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ export class AlphaVantageService implements DataProviderInterface { |
|
|
|
} |
|
|
|
|
|
|
|
public canHandle(symbol: string) { |
|
|
|
return this.configurationService.get('ALPHA_VANTAGE_API_KEY'); |
|
|
|
return !!this.configurationService.get('ALPHA_VANTAGE_API_KEY'); |
|
|
|
} |
|
|
|
|
|
|
|
public async get( |
|
|
|
|
|
@ -31,7 +31,7 @@ export class RakutenRapidApiService implements DataProviderInterface { |
|
|
|
public canHandle(symbol: string) { |
|
|
|
return ( |
|
|
|
isRakutenRapidApiSymbol(symbol) && |
|
|
|
this.configurationService.get('RAKUTEN_RAPID_API_KEY') |
|
|
|
!!this.configurationService.get('RAKUTEN_RAPID_API_KEY') |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|