security: session-day calendar boundaries + mid-UTC-day tz-offset memo - #160
Merged
Conversation
Two defects kept FX daily/weekly request.security series wrong while equities looked fine: - Calendar D/W/M keys split at symbol-local midnight; TV forex candles run 17:00-ET -> 17:00-ET (measured 472/472 TV triggers satisfied by the 17:00 session-day cut, zero by local-midnight cuts). Calendar periods now ride the session-day clock; equities coincide with local midnight, so their series are unchanged. - The per-UTC-day tz-offset memo paired the LOCAL midnight with the QUERY instant's UTC floor: any bar whose local date straddles UTC midnight (FX evenings) seeded the whole UTC day with a negative offset, splitting every HTF candle in two with a spurious boundary completion + bogus fragment close. Sample the offset at mid-UTC-day: constant, correct, DST-safe. 24x7 symbols return before the memo (ETH byte-identical); equity RTH bars never straddle a UTC date (values identical). Evidence @ this tree: EURUSD htf-bucket probes D 8.6%->100% (471/471), 240m 76%->100% (1296/1296); population e+s EURUSD 307->327 (+20), AAPL 241->246; ETH scraped 396/396 zero moves; corpus 309/2/1 identical, zero regressions; 133/133 unit tests.
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.
Round 2 of the symbol campaign (follows #159). Two coupled defects kept FX daily/weekly
request.securityseries wrong while equities looked fine.Defect 1 — calendar clock. D/W/M keys split at symbol-local midnight; TV forex candles run 17:00-ET → 17:00-ET (measured: all 472 TV probe triggers satisfied by the session-day cut, zero by any midnight cut — reconstruction in ledger finding 402 follow-ups). Calendar periods now ride the session-day clock. Equities coincide with local midnight, so their series are unchanged.
Defect 2 — tz memo poisoning. The per-UTC-day offset memo paired the local midnight with the query instant's UTC floor. Any bar whose local date straddles UTC midnight (every FX evening bar) seeded the whole UTC day with −20h instead of +4h — splitting every HTF candle in two with a spurious boundary completion and a bogus evening-fragment close. The memo now samples at mid-UTC-day: constant and correct all day, DST-safe (transitions land while session markets are closed).
Evidence @
46d4f64(codegen unchanged at 726a0f4):Known residual (next round): probe-vs-tv on the EURUSD daily probe reports 10 engine-only fills beyond TV's export window edge (window-edge mechanics, not level semantics); weekly FX anchor uses ISO-Monday of the session-day clock vs TV's Sunday-17:00 week start — W probe still divergent, queued.
Symbol-gate PASS · pr-gate PASS (tie carried by trendmatrix MATCH probe, 822/822).