docs: correct the reason crude's back-adjusted series goes negative - #87
Merged
Merged
Conversation
Found by a test failing against real data while building crowdmon's notional module. The number was right, the explanation was wrong, and the real one is a better argument for the same conclusion. I wrote that crude's back-adjusted series "reaches -27.52, which is not a price", attributing it to additive back-adjustment accumulating roll gaps below zero over decades. Measured: both series bottom in April 2020. What actually happens is that the single enormous roll gap out of the May 2020 contract, which settled at -37.63, is propagated backwards through every earlier bar. The sharpest row in the store is 2020-04-21: crude traded at +11.57, an ordinary positive price, while the back-adjusted bar for that day reads -27.52. Crude was genuinely below zero on exactly ONE day; the back-adjusted series is below zero on 64. A second claim in the same paragraph was also wrong. I asserted the unadjusted series can never be negative; it can, because 2020-04-20 happened and unadj records it faithfully. That matters for implementations: a negative price is not by itself evidence of the wrong series, so normalisation code must not clip or reject one. On that day a long position genuinely had negative notional, and anything assuming sign(notional) == sign(position) is wrong on real data. The primary evidence is unaffected: the +294% / +257% / +194% errors are measured directly, and the CL offset is 0.0000 today against 105.47 on 2004-12-13. Docs only; 257 tests still pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Found by a test failing against real data while building crowdmon's notional module. The number was right, the explanation was wrong, and the real one is a better argument for the same conclusion.
I wrote that crude's back-adjusted series "reaches -27.52, which is not a price", attributing it to additive back-adjustment accumulating roll gaps below zero over decades.
Measured: both series bottom in April 2020. What actually happens is that the single enormous roll gap out of the May 2020 contract, which settled at -37.63, is propagated backwards through every earlier bar.
The sharpest row in the store is 2020-04-21:
Crude traded at an ordinary positive price on the 21st while the back-adjusted bar reported a large negative one. Crude was genuinely below zero on exactly one day; the back-adjusted series is below zero on 64.
A second claim was also wrong
I asserted the unadjusted series can never be negative. It can, because 2020-04-20 happened and unadj records it faithfully.
That matters for implementations: a negative price is not by itself evidence of the wrong series, so normalisation code must not clip or reject one. On that day a long position genuinely had negative notional, and anything assuming
sign(notional) == sign(position)is wrong on real data. crowdmon'snotional.pynow says so explicitly.Unaffected
The primary evidence stands: the +294% / +257% / +194% errors are measured directly, and the CL offset is 0.0000 today against 105.47 on 2004-12-13.
Docs only. 257 tests still pass.
Generated with Claude Code