Repository navigation
fix: tick-rule sign carry, run-bar threshold units, GARCH look-ahead, Roll spread covariance - #71
Closed
quantum-like wants to merge 5 commits into
Closed
quantum-like wants to merge 5 commits into
quantum-like wants to merge 5 commits into
Conversation
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]>
The run-bar expectation was initialized as E[T] times average trade value, then updated with the bar's tick count. After warmup the threshold collapsed by about the average trade size and later bars closed almost every tick. Co-authored-by: quantum-like <[email protected]>
The initial variance was the sample variance of the next 20 returns, so a future shock raised earlier forecasts. The horizon recursion also ignored the current return. Initialization now uses only the first return, and the forecast at each row uses information available at that row. Co-authored-by: quantum-like <[email protected]>
The estimator subtracted each bar's own trailing mean and then averaged those products, which is not the covariance of the current window. The spread now uses E[xy] - E[x]E[y] over that window. Co-authored-by: quantum-like <[email protected]>
The registered warm-up was twice the window because the old estimator nested two rolling means. The window covariance is first defined one bar after the lag is available. Co-authored-by: quantum-like <[email protected]>
This was referenced Oct 14, 2026
Contributor
|
The four useful fixes now have focused owning records: tick sign #78/#79, run-bar units #80/#81, GARCH look-ahead #82/#83, and Roll covariance #84/#85. Original contributor commit authorship is retained. The GARCH replacement includes a public-expression regression that fails on the base. Closing this bundle as superseded; the focused PRs still require hosted qualification and independent merges. |
Contributor
Author
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.
Owning issue
Closes #69
Outcome
5 correctness fixes, one commit each, each with a focused test:
tests/features/test_microstructure.py::test_effective_tick_rule_carries_previous_sign. (e7e7622)tests/bars/test_run_bars.py::test_volume_run_expectation_does_not_collapse_to_tick_counts,::test_dollar_run_expectation_stays_in_dollar_units. (d587c6a)tests/features/volatility/test_volatility_comprehensive.py::test_forecast_ignores_future_returns. (a20fee6)tests/features/test_microstructure.py::test_roll_spread_matches_window_covariance. (2833f1e)period + 1to match the corrected estimator. Test: covered by existing lookback tests. (5b47b7a)Compatibility
GARCH forecast and Roll spread outputs change numerically, and run bars are larger after warm-up. These are corrections, but downstream results built on them will move.
Verification
mainand passes with its fix)ruff format --checkis clean on the changed files andruff checkreports nothing new in them versusmain, but I did not run the full pre-commit suite)typasses (not run on this branch)pytest(57perftests deselected): 3940 passed before, 3945 passed after.Documentation and release
No documentation changes. The behavior changes above may be worth a line in the next patch-release notes.
Amir