feat: reconcile hourly investment resource states

This commit is contained in:
2026-10-09 19:56:14 +03:00
parent 2facd8675c
commit aee330c6c2
25 changed files with 445 additions and 86 deletions
@@ -106,7 +106,7 @@ export class CandleService {
true,
['detail'],
);
if (detail.meta.availability === 'complete' && !detail.instrument) {
if (detail.meta.completeness === 'complete' && !detail.instrument) {
throw new NotFoundException();
}
const now = new Date();
@@ -114,8 +114,7 @@ export class CandleService {
? rangeFor(input, detail.instrument, now)
: null;
const saved = range ? await this.repository.read(input.uid, range) : null;
const gaps = range && saved ? candleGaps(range, saved.coverage, now) : [];
if (!observe && (!saved || gaps.length)) {
if (!observe && !saved) {
await this.request(userId, revision, input, now);
}
const work = await this.repository.work(userId, revision, scope(input));