MCPcopy Create free account
hub / github.com/Open-Quant/openquant / build_dollar_bars

Function build_dollar_bars

python/openquant/bars.py:113–120  ·  view source on GitHub ↗
(
    df: pl.DataFrame,
    *,
    dollar_value_per_bar: float = 5_000_000.0,
)

Source from the content-addressed store, hash-verified

111
112 The input goes through `openquant.data.clean_ohlcv` first (column aliases resolved, rows
113 with nulls dropped, duplicate `(symbol, ts)` keys removed) and is then processed one
114 symbol at a time. Each input row is treated as one trade at its `close` price with its
115 `volume`; the input `open`, `high`, `low` and `adj_close` are ignored, so the output
116 `high`/`low` are the extremes of the input closes.
117
118 A bar closes on the first row at least `interval` after the bar's first row, and that
119 row belongs to the closing bar; bars are anchored to each bar's first row, not to the
120 wall clock. A trailing partial bar is kept as a final, shorter bar.
121
122 Parameters
123 ----------

Callers

nothing calls this directly

Calls 1

_build_by_symbolFunction · 0.85

Tested by

no test coverage detected