Feature/improve data gathering for currencies (#581)

* Improve data gathering for currencies, add warning if it fails

* Update changelog
This commit is contained in:
Thomas Kaul 2021-12-26 09:15:10 +01:00 committed by GitHub
parent bbc4e64cb4
commit 0043b44670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 12 deletions

View File

@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added a warning to the log if the data gathering fails
### Fixed
- Filtered potential `null` currencies
- Improved the 7d data gathering optimization for currencies
## 1.94.0 - 25.12.2021

View File

@ -334,6 +334,7 @@ export class DataGatheringService {
?.marketPrice;
}
if (lastMarketPrice) {
try {
await this.prismaService.marketData.create({
data: {
@ -344,6 +345,14 @@ export class DataGatheringService {
}
});
} catch {}
} else {
Logger.warn(
`Failed to gather data for symbol ${symbol} at ${format(
currentDate,
DATE_FORMAT
)}.`
);
}
// Count month one up for iteration
currentDate = new Date(
@ -492,8 +501,8 @@ export class DataGatheringService {
}
})
)
.filter((symbolProfile) => {
return symbolsToGather.includes(symbolProfile.symbol);
.filter(({ symbol }) => {
return symbolsToGather.includes(symbol);
})
.map((symbolProfile) => {
return {
@ -504,6 +513,9 @@ export class DataGatheringService {
const currencyPairsToGather = this.exchangeRateDataService
.getCurrencyPairs()
.filter(({ symbol }) => {
return symbolsToGather.includes(symbol);
})
.map(({ dataSource, symbol }) => {
return {
dataSource,