feat: preserve extra bar fields; diagonal concat for realtime bars#95
Open
rupurt wants to merge 1 commit into
Open
feat: preserve extra bar fields; diagonal concat for realtime bars#95rupurt wants to merge 1 commit into
rupurt wants to merge 1 commit into
Conversation
The bars API can return fields beyond OHLCV. Rather than dropping them, get_bars now keeps any extra fields (canonical timestamp/open/high/low/close/ volume first), so callers retain the richer data. To keep the realtime data manager schema-safe, its three bar-append sites now use diagonal concatenation, so a six-column realtime bar can extend a wider historical frame (extra fields become null on the realtime bar) instead of raising "unable to append to a DataFrame of width N with a DataFrame of width 6".
rupurt
added a commit
to rupurt/project-x-py
that referenced
this pull request
Jul 6, 2026
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.
Problem
When the bars API response includes fields beyond OHLCV,
get_barsreturned a frame wider than the six-column bars the realtime data manager constructs. Seeding a timeframe fromget_barsand then appending a new realtime bar failed withpl.exceptions.ShapeError: unable to append to a DataFrame of width N with a DataFrame of width 6, spamming errors and freezing realtime timeframes (most visibly the fast ones like 5min).Fix
get_barspreserves any extra API fields (canonical OHLCV columns first) instead of dropping them.pl.concat(..., how="diagonal_relaxed"), so a six-column realtime bar extends a wider historical frame (extra fields become null) rather than raising a width mismatch.Tests
tests/client/test_market_data.py(17) pass; realtime_data_manager suite unaffected; ruff + mypy clean.