fix: preserve unknown external cash flow in live returns - #640
Merged
Merged
Conversation
Co-Authored-By: Codex <noreply@openai.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.
Live equity records without an external cash-flow field were treated as zero flow: a synthetic equity change from 100 to 200 produced a trusted 100% return. Missing flow now remains unknown, and only explicit finite flows qualify for adjusted returns.
Keep only the latest comparable segment after an unknown interval and propagate incompleteness through collector/monitor, including CSV+live merges and combined calendar/observation gaps. The strict Binance interval path and explicit research-helper zero-flow assumption remain unchanged. No production inputs are filled with invented zero flows.
Validation: baseline reproduction returned
ok [1.0]; patched input returnsinsufficient_observations:invalid_cash_flowand no returns. Focused collector/monitor/store tests: 116 passed, 37 subtests passed. Ruff and diff check pass. Independent review identified the CSV merge issue, which was corrected and rechecked. This is synthetic engineering evidence, not an observed live incident or runtime deployment.