feat(candles): support 1d interval in aggregator#454
Open
Nuwe10 wants to merge 1 commit into
Open
Conversation
The 1d CandleInterval was already wired into INTERVAL_MS, the BullMQ
SCHEDULES (cron '0 0 * * *'), VALID_INTERVALS in the price controller,
and getIntervalSeconds in the price service.
This commit makes the 1d support explicit and verified:
- Adds a JSDoc comment on the '1d' entry in INTERVAL_MS explaining the
UTC midnight-boundary semantics and how the cron firing time aligns
with the period calculation.
- Adds candles.service.spec.ts with unit tests covering:
• no-op when no swaps exist for the period
• correct OHLCV computation for a single pool over a 1d window
• separate candles written per distinct pool
• correct 86_400_000 ms query window for the '1d' interval
• all four intervals (1m, 5m, 1h, 1d) resolve without error
Closes Vatix-Protocol#420
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Formalises and tests the
1dcandle interval in the aggregator pipeline.What was already in place
CandleIntervaltype'1d'presentINTERVAL_MS['1d']86_400_000SCHEDULEScron'0 0 * * *'VALID_INTERVALSin price controller'1d'includedgetIntervalSeconds / getDefaultIntervalSecondsWhat this PR adds
'1d'entry inINTERVAL_MSdocumenting the UTC midnight-boundary semantics and the relationship between the cron fire time and the period-window calculation.candles.service.spec.ts— unit tests covering:1dis exactly86_400_000 ms1m,5m,1h,1d) resolve without errorValidation
package.jsonCloses #420