Skip to content

fix(features): carry the previous sign in the effective tick rule - #79

Merged
stefan-jansen merged 4 commits into
mainfrom
codex/tick-rule-flat-sign
Oct 15, 2026
Merged

stefan-jansen merged 4 commits into
mainfrom
codex/tick-rule-flat-sign

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #78. Supersedes the tick-rule portion of #71.

Carry the last observed nonzero trade sign across unchanged prices, leaving an unobservable adjacent price comparison unclassified. Normalize NaN price changes before sign comparisons so a real CSV missing price cannot become an uptick or corrupt later flat-price classifications. Order-flow imbalance uses the same implementation instead of a divergent duplicate.

At head 8b44031, refreshed onto qualified main 828d594, all 76 microstructure tests and the full 4,252-test suite pass on Python 3.12, 3.13 and 3.14 (57 intentional deselections).

Permanent real-CSV and grouped-state regressions showed 10 failures and eight passing empty-field controls before the additional producer repair; they pass afterward. Coverage includes eager/lazy evaluation, string/expression inputs, buy/sell histories, order-flow consumers, symbol isolation, leading unchanged prices, empty/singleton/all-missing inputs, and integer-price compatibility. Existing finite flat-price and Roll covariance regressions are preserved.

Additional compatibility review found that direct fill_nan rejects Polars Decimal prices. Four permanent eager/lazy tick/order-flow regressions fail at 5bdad31 and pass at the current head. Compute differences in the original numeric type before casting for NaN handling. A controlled producer mutation that casts prices first fails the two high-precision cases, proving that small moves in large Decimal prices are not rounded away. The same four public cases also pass on pre-normalization revision 8fab64b.

Ruff, formatting, ty, all-file hooks, lock validation, wheel/sdist build, import, twine metadata checks and strict MkDocs pass. The isolated built wheel passes both public CSV-gap and Decimal reproductions. Fresh current-head supported-platform hosted qualification is required before merge; earlier checks retain their actual tested revisions and do not qualify the current head.

Trade signs and order-flow values change and warrant inclusion in the eventual qualified patch release. This PR does not publish a release or deploy documentation.

AI assistance: Codex reproduced public classification failures and the Decimal compatibility defect, inspected the actual diffs and overlap, implemented the focused repairs and permanent regressions, ran checks and drafted this description. Original Cursor Agent source-fix authorship is retained; supplemental repairs are separate Stefan Jansen commits.

Unchanged prices were stored as 0 before forward-fill, so the fill never
replaced them and flat trades were classified as no trade. Zero changes now
keep the previous nonzero tick, including in order-flow imbalance.

Co-authored-by: quantum-like <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen
stefan-jansen merged commit 0a3acdc into main Oct 15, 2026
31 checks passed
@stefan-jansen
stefan-jansen deleted the codex/tick-rule-flat-sign branch October 15, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: carry the previous tick sign across flat trades

3 participants