Bugfix/fix symbol selection of 7d data gathering (#670)

* Fix symbol selection of 7d data gathering

* Update changelog
pull/671/head
Thomas Kaul 3 years ago committed by GitHub
parent dc424a86ec
commit f369996912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for deleting symbol profile data in the admin control panel
### Fixed
- Fixed the symbol selection of the 7d data gathering
### Changed
- Used `dataSource` and `symbol` from `SymbolProfile` instead of the `order` object (in `ExportService` and `PortfolioService`)

@ -473,9 +473,18 @@ export class DataGatheringService {
private async getSymbols7D(): Promise<IDataGatheringItem[]> {
const startDate = subDays(resetHours(new Date()), 7);
const symbolProfiles = await this.prismaService.symbolProfile.findMany({
orderBy: [{ symbol: 'asc' }],
select: {
dataSource: true,
scraperConfiguration: true,
symbol: true
}
});
// Only consider symbols with incomplete market data for the last
// 7 days
const symbolsToGather = (
const symbolsNotToGather = (
await this.prismaService.marketData.groupBy({
_count: true,
by: ['symbol'],
@ -485,24 +494,15 @@ export class DataGatheringService {
})
)
.filter((group) => {
return group._count < 6;
return group._count >= 6;
})
.map((group) => {
return group.symbol;
});
const symbolProfilesToGather = (
await this.prismaService.symbolProfile.findMany({
orderBy: [{ symbol: 'asc' }],
select: {
dataSource: true,
scraperConfiguration: true,
symbol: true
}
})
)
const symbolProfilesToGather = symbolProfiles
.filter(({ symbol }) => {
return symbolsToGather.includes(symbol);
return !symbolsNotToGather.includes(symbol);
})
.map((symbolProfile) => {
return {
@ -514,7 +514,7 @@ export class DataGatheringService {
const currencyPairsToGather = this.exchangeRateDataService
.getCurrencyPairs()
.filter(({ symbol }) => {
return symbolsToGather.includes(symbol);
return !symbolsNotToGather.includes(symbol);
})
.map(({ dataSource, symbol }) => {
return {

Loading…
Cancel
Save