|
|
@ -136,7 +136,8 @@ export class ManualService implements DataProviderInterface { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getQuotes({ |
|
|
public async getQuotes({ |
|
|
symbols |
|
|
symbols, |
|
|
|
|
|
useCache = true |
|
|
}: GetQuotesParams): Promise<{ [symbol: string]: DataProviderResponse }> { |
|
|
}: GetQuotesParams): Promise<{ [symbol: string]: DataProviderResponse }> { |
|
|
const response: { [symbol: string]: DataProviderResponse } = {}; |
|
|
const response: { [symbol: string]: DataProviderResponse } = {}; |
|
|
|
|
|
|
|
|
@ -164,17 +165,17 @@ export class ManualService implements DataProviderInterface { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const symbolProfilesWithScraperConfigurationAndInstantMode = |
|
|
const symbolProfilesToScrape = symbolProfiles.filter( |
|
|
symbolProfiles.filter(({ scraperConfiguration }) => { |
|
|
({ scraperConfiguration }) => { |
|
|
return ( |
|
|
return ( |
|
|
scraperConfiguration?.mode === 'instant' && |
|
|
(scraperConfiguration?.mode === 'instant' || !useCache) && |
|
|
scraperConfiguration?.selector && |
|
|
scraperConfiguration?.selector && |
|
|
scraperConfiguration?.url |
|
|
scraperConfiguration?.url |
|
|
); |
|
|
); |
|
|
}); |
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
const scraperResultPromises = |
|
|
const scraperResultPromises = symbolProfilesToScrape.map( |
|
|
symbolProfilesWithScraperConfigurationAndInstantMode.map( |
|
|
|
|
|
async ({ scraperConfiguration, symbol }) => { |
|
|
async ({ scraperConfiguration, symbol }) => { |
|
|
try { |
|
|
try { |
|
|
const marketPrice = await this.scrape({ |
|
|
const marketPrice = await this.scrape({ |
|
|
|