Skip to content

v0.2: rewrite processing and rendering (fixes #4, #6; live example for #5) - #7

Merged
murtazayusuf merged 1 commit into
mainfrom
revamp-v2
Nov 1, 2026
Merged

murtazayusuf merged 1 commit into
mainfrom
revamp-v2

Conversation

@murtazayusuf

Copy link
Copy Markdown
Owner

Why

The bundled examples crashed on current pandas (ohlc['high'][-1] on a DatetimeIndex), so a fresh install could not render anything. With that patched, charts were still scrambled: the x-axis was categorical over random 5-character identifiers, so candle order depended on input row order, and range-bar order relied on identifier string length as a hidden sequence number.

What changed

Processing

  • Candles get an integer bar index. Rows link by identifier_col (range/tick/volume bars) or by timestamp (index or time column, tz-aware) for time bars. Fixes Unclear documentation - how is 'identifier' handled of not present? #4.
  • Candles always sort by time; candles sharing a timestamp keep input order. Fixes chaotic #6.
  • Tick size inferred from within-candle price gaps; small-tick instruments (0.01, 0.005) no longer get an empty y-range.
  • Diagonal imbalance computed per candle by price, zero-safe; optional horizontal mode; custom imbalance column still supported.
  • Stats panel: volume, delta, true cumulative delta (was a rolling 10-bar sum), delta %, POC.
  • Clear OrderFlowDataError messages instead of "Data processing failed".
  • New: OrderFlowChart.from_trades() (build from a trade tape), update(), and bars / footprint / stats properties.
  • get_processed_data uses a compact v2 format; v0.1 JSON files still load.

Rendering

  • Numeric x-axis, all geometry in data units: bid/ask cells, candle beside the cells (no longer covering the numbers), horizontal volume-profile bars with POC highlighted. Stays aligned at any zoom.
  • Initial viewport shows the latest 8 candles at a readable number of price levels.
  • uirevision keeps pan/zoom across live refreshes (will it work on real time market #5, see examples/live_dash.py).

Project

  • pyproject.toml (pip installable), loosened requirements, .gitignore, committed __pycache__ removed.
  • 17 pytest tests; CI on Python 3.9 / pandas 1.5 / plotly 5.9 and Python 3.13 / latest.
  • README rewritten in Markdown (install, data format, options, live usage, roadmap, contributing) with a new screenshot.

Compatibility notes

  • Public API is unchanged: OrderFlowChart(orderflow_data, ohlc_data, identifier_col, imbalance_col), plot(return_figure=...), get_processed_data(), from_preprocessed_data().
  • cum_delta is now a true running total, so values differ from v0.1.

Fixes #4
Fixes #6


Generated by Claude Code

The bundled examples crashed on current pandas (Series[-1] on a
DatetimeIndex), and time-bar data rendered out of order because the x-axis
was categorical over random identifiers whose order depended on input sort.

Processing
- Candles get an integer bar index; rows link by identifier_col or by
  timestamp (index or time column), tz-aware. Fixes #4.
- Candles sorted by time with stable order for shared timestamps; the old
  identifier-length "sequence" hack is gone. Fixes #6.
- Tick size inferred from within-candle level gaps, not the first two rows.
- Diagonal imbalance computed per candle by price, zero-safe; optional
  horizontal mode; user imbalance column still supported.
- Stats: volume, delta, true cumulative delta, delta %, POC.
- Actionable OrderFlowDataError messages replace bare except clauses.
- from_trades() builds footprints from a trade tape; update() for live use.
- get_processed_data/from_preprocessed_data use a compact v2 format and
  still load v0.1 files.

Rendering
- Numeric x-axis with all geometry in data units: cells, candle beside the
  cells, horizontal volume-profile bars with POC highlight.
- Initial viewport fits readable price levels; y-range no longer collapses
  for 0.01-tick instruments (int() truncation).
- uirevision keeps pan/zoom across live refreshes.

Project
- pyproject.toml (pip installable), loosened requirements, .gitignore,
  removed committed __pycache__.
- pytest suite (17 tests) and CI on py3.9/pandas 1.5/plotly 5.9 and
  py3.13/latest.
- README rewritten in Markdown with install, data format, options, live
  usage, roadmap and contributing sections; examples/from_trades.py and
  examples/live_dash.py.
@murtazayusuf
murtazayusuf merged commit 9f54638 into main Nov 1, 2026
2 checks passed
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.

chaotic Unclear documentation - how is 'identifier' handled of not present?

1 participant