Browse Source
Bugfix/response of historical market data gathering for a specific date (#7717)
* Fix response of historical market data gathering for a specific date
* Update changelog
pull/7722/head
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
43 additions and
4 deletions
-
CHANGELOG.md
-
apps/api/src/app/admin/admin.controller.ts
-
apps/api/src/services/queues/data-gathering/data-gathering.service.spec.ts
-
apps/api/src/services/queues/data-gathering/data-gathering.service.ts
|
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Changed |
|
|
|
|
|
|
|
- Migrated the create and edit access dialogs to dedicated routes |
|
|
|
- Improved the response of the historical market data gathering endpoint for a specific date |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
|
|
|
|
@ -213,11 +213,20 @@ export class AdminController { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return this.dataGatheringService.gatherSymbolForDate({ |
|
|
|
const marketData = await this.dataGatheringService.gatherSymbolForDate({ |
|
|
|
dataSource, |
|
|
|
date, |
|
|
|
symbol |
|
|
|
}); |
|
|
|
|
|
|
|
if (!marketData) { |
|
|
|
throw new HttpException( |
|
|
|
getReasonPhrase(StatusCodes.NOT_FOUND), |
|
|
|
StatusCodes.NOT_FOUND |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return marketData; |
|
|
|
} |
|
|
|
|
|
|
|
@HasPermission(permissions.accessAdminControl) |
|
|
|
|
|
|
|
@ -219,5 +219,34 @@ describe('DataGatheringService', () => { |
|
|
|
}) |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
it('returns the upserted market data', async () => { |
|
|
|
dataProviderService.getHistoricalRaw.mockResolvedValue({ |
|
|
|
'YAHOO-AAPL': { |
|
|
|
'2026-08-22': { marketPrice: 100 } |
|
|
|
} |
|
|
|
}); |
|
|
|
prismaService.marketData.upsert.mockResolvedValue({ marketPrice: 100 }); |
|
|
|
|
|
|
|
const marketData = await dataGatheringService.gatherSymbolForDate({ |
|
|
|
dataSource: 'YAHOO', |
|
|
|
date: parseDate('2026-08-22'), |
|
|
|
symbol: 'AAPL' |
|
|
|
}); |
|
|
|
|
|
|
|
expect(marketData).toEqual({ marketPrice: 100 }); |
|
|
|
}); |
|
|
|
|
|
|
|
it('returns undefined if the data provider has no market price', async () => { |
|
|
|
dataProviderService.getHistoricalRaw.mockResolvedValue({}); |
|
|
|
|
|
|
|
const marketData = await dataGatheringService.gatherSymbolForDate({ |
|
|
|
dataSource: 'YAHOO', |
|
|
|
date: parseDate('2026-08-22'), |
|
|
|
symbol: 'AAPL' |
|
|
|
}); |
|
|
|
|
|
|
|
expect(marketData).toBeUndefined(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -348,10 +348,10 @@ export class DataGatheringService { |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.logger.error(error.message); |
|
|
|
} finally { |
|
|
|
return undefined; |
|
|
|
this.logger.error(error?.message); |
|
|
|
} |
|
|
|
|
|
|
|
return undefined; |
|
|
|
} |
|
|
|
|
|
|
|
public async gatherSymbols({ |
|
|
|
|