|
@ -166,27 +166,26 @@ export class ManualService implements DataProviderInterface { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const symbolProfilesWithScraperConfiguration = symbolProfiles.filter( |
|
|
const symbolProfilesWithScraperConfigurationAndInstantMode = |
|
|
({ scraperConfiguration }) => { |
|
|
symbolProfiles.filter(({ scraperConfiguration }) => { |
|
|
return !!scraperConfiguration?.url; |
|
|
return scraperConfiguration?.mode === 'instant'; |
|
|
} |
|
|
}); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const scraperResultPromises = symbolProfilesWithScraperConfiguration.map( |
|
|
const scraperResultPromises = |
|
|
({ scraperConfiguration, symbol }) => { |
|
|
symbolProfilesWithScraperConfigurationAndInstantMode.map( |
|
|
return this.scrape(scraperConfiguration) |
|
|
async ({ scraperConfiguration, symbol }) => { |
|
|
.then((marketPrice) => { |
|
|
try { |
|
|
|
|
|
const marketPrice = await this.scrape(scraperConfiguration); |
|
|
return { marketPrice, symbol }; |
|
|
return { marketPrice, symbol }; |
|
|
}) |
|
|
} catch (error) { |
|
|
.catch((error) => { |
|
|
|
|
|
Logger.error( |
|
|
Logger.error( |
|
|
`Could not get quote for ${symbol} (${this.getName()}): [${error.name}] ${error.message}`, |
|
|
`Could not get quote for ${symbol} (${this.getName()}): [${error.name}] ${error.message}`, |
|
|
'ManualService' |
|
|
'ManualService' |
|
|
); |
|
|
); |
|
|
return { symbol, marketPrice: undefined }; |
|
|
return { symbol, marketPrice: undefined }; |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// Wait for all scraping requests to complete concurrently
|
|
|
// Wait for all scraping requests to complete concurrently
|
|
|
const scraperResults = await Promise.all(scraperResultPromises); |
|
|
const scraperResults = await Promise.all(scraperResultPromises); |
|
|