clockbars 0.1.1__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clockbars-0.1.1 → clockbars-1.0.0}/CHANGELOG.md +23 -43
- {clockbars-0.1.1 → clockbars-1.0.0}/CITATION.cff +4 -4
- {clockbars-0.1.1 → clockbars-1.0.0}/PKG-INFO +6 -5
- {clockbars-0.1.1 → clockbars-1.0.0}/README.md +5 -4
- {clockbars-0.1.1 → clockbars-1.0.0}/pyproject.toml +1 -1
- {clockbars-0.1.1 → clockbars-1.0.0}/src/clockbars/__init__.py +1 -1
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_threshold_bars.py +12 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/uv.lock +1 -1
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/dependabot.yml +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/workflows/ci.yml +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.github/workflows/release.yml +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/.gitignore +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/CONTRIBUTING.md +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/LICENSE +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/docs/hero.png +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/docs/paper.md +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/examples/make_hero.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/src/clockbars/builder.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/src/clockbars/core.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/src/clockbars/py.typed +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/src/clockbars/synthetic.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/conftest.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_builder.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_pandas.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_sessions.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_synthetic.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_time_bars.py +0 -0
- {clockbars-0.1.1 → clockbars-1.0.0}/tests/test_validation.py +0 -0
|
@@ -4,32 +4,9 @@ Notable changes to clockbars are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[SemVer](https://semver.org/).
|
|
6
6
|
|
|
7
|
-
## [0.
|
|
7
|
+
## [1.0.0] - 2026-11-27
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Writing pass over the README, paper, changelog, and contributing guide,
|
|
12
|
-
measured with the humanize-ai-writing checker: 70 machine-style tells
|
|
13
|
-
(em-dash density, negative parallelism) reduced to zero. The one remaining
|
|
14
|
-
flag is the word "Paradigm" inside a cited paper's title, which stays
|
|
15
|
-
verbatim.
|
|
16
|
-
- New hero figure: volume histograms above, both sampling clocks overlaid
|
|
17
|
-
on a single session below, in one consistent palette.
|
|
18
|
-
- Motivation now cites published measurements alongside the synthetic demo:
|
|
19
|
-
Oomen (2006) on transaction-time sampling cutting realized-variance MSE
|
|
20
|
-
by about 5 percent on average and up to 40 percent on irregular days;
|
|
21
|
-
Grądzki, Wójcik, and Lessmann (2025) on dollar bars being the weakest
|
|
22
|
-
sampling scheme on wash-traded crypto volume; Griffin and Oomen (2008)
|
|
23
|
-
on tick time versus transaction time.
|
|
24
|
-
- Paper: abstract, sections 1 and 3, references, and limitations reworked
|
|
25
|
-
to carry the new evidence; software references regrouped.
|
|
26
|
-
|
|
27
|
-
No behavior changes. 171 tests, 100 percent coverage, strict mypy: all
|
|
28
|
-
unchanged.
|
|
29
|
-
|
|
30
|
-
## [0.1.0] - 2026-11-27
|
|
31
|
-
|
|
32
|
-
First release.
|
|
9
|
+
Initial public release.
|
|
33
10
|
|
|
34
11
|
### Added
|
|
35
12
|
|
|
@@ -43,47 +20,50 @@ First release.
|
|
|
43
20
|
and `flush()` for the trailing bar. `bars_to_frame()` collects bars with
|
|
44
21
|
exactly `resample()`'s schema and dtypes.
|
|
45
22
|
- Restart-from-zero threshold rule: the crossing trade closes its bar, a
|
|
46
|
-
closed bar's total always meets
|
|
23
|
+
closed bar's total always meets its threshold, and only the final bar
|
|
47
24
|
of a segment can be partial: flagged, never dropped.
|
|
48
25
|
- Strict input validation: timezone-aware timestamps normalized to
|
|
49
26
|
`Datetime("ns", "UTC")`, sortedness required, and finiteness checked
|
|
50
27
|
separately from sign so NaN and inf cannot pass a sign check.
|
|
51
28
|
- Deterministic seeded trade generator (`synthetic_ticks`) with one
|
|
52
|
-
session per business day, U-shaped arrivals, size clustering at the
|
|
53
|
-
|
|
29
|
+
session per business day, U-shaped arrivals, size clustering at the open
|
|
30
|
+
and close, and volatility scaling with trade size.
|
|
54
31
|
- pandas input adapter, held to the same validation as Polars input.
|
|
55
|
-
-
|
|
32
|
+
- 172 tests: conservation, contiguity, threshold, partial-flag, OHLC and
|
|
56
33
|
VWAP consistency, determinism, validation, the pandas path, session
|
|
57
|
-
cuts, streaming parity with the batch
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
cuts, float-accumulation tolerance, streaming parity with the batch
|
|
35
|
+
path, and 200,000-trade scale runs.
|
|
36
|
+
- CI on Ubuntu and Windows across Python 3.11 through 3.14: ruff, strict
|
|
37
|
+
mypy, and pytest with statement coverage required at 100 percent.
|
|
60
38
|
- `py.typed` marker, so downstream type checkers see the package's types.
|
|
61
39
|
- `examples/make_hero.py` regenerates the README figure and its table
|
|
62
40
|
from a seed.
|
|
63
|
-
- `docs/paper.md`:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
- `docs/paper.md`: the fifty-nine-year history of activity sampling, its
|
|
42
|
+
one genuinely contested claim, and the failure modes the test suite
|
|
43
|
+
pins, with published measurements cited alongside the library's own
|
|
44
|
+
reproducible numbers.
|
|
45
|
+
- `CITATION.cff`, `CONTRIBUTING.md`, issue and PR templates, and a
|
|
46
|
+
dependabot schedule.
|
|
67
47
|
|
|
68
48
|
### Design decisions worth knowing before depending on this
|
|
69
49
|
|
|
70
50
|
- Overshoot is not carried into the next bar. A global cumulative sum
|
|
71
51
|
would dock the following bar for the previous bar's overshoot and close
|
|
72
|
-
it below threshold mid-series;
|
|
52
|
+
it below threshold mid-series; clockbars restarts each bar at zero.
|
|
73
53
|
- Threshold comparisons use a `1e-9` relative tolerance, because summed
|
|
74
|
-
floats land on `499.9999999999999` and strict comparison would flag
|
|
54
|
+
floats land on `499.9999999999999` and a strict comparison would flag
|
|
75
55
|
phantom partial bars.
|
|
76
56
|
- A fractional tick threshold rounds up: 2.5 closes bars of 3 trades.
|
|
77
57
|
- Time-bar windows are half-open `[start, start + every)`, compound
|
|
78
58
|
intervals like `1h30m` are summed, and alignment is to the epoch, not
|
|
79
59
|
to the first trade.
|
|
80
60
|
- Batch and streaming must agree: exactly on bar boundaries, timestamps,
|
|
81
|
-
OHLC, counts, and partial flags; per-bar volume and
|
|
82
|
-
float-summation order (
|
|
83
|
-
and a sequential accumulator sum the same floats
|
|
61
|
+
OHLC, counts, and partial flags; per-bar volume, notional, and vwap to
|
|
62
|
+
within float-summation order (at most `1e-12` relative), because a
|
|
63
|
+
vectorised group sum and a sequential accumulator sum the same floats
|
|
64
|
+
in different orders.
|
|
84
65
|
- A trade exactly on a session boundary belongs to the new session, and a
|
|
85
66
|
session's final short bar is flagged partial, never merged into the next
|
|
86
67
|
day.
|
|
87
68
|
|
|
88
|
-
[0.
|
|
89
|
-
[0.1.0]: https://github.com/zzionz/clockbars/releases/tag/v0.1.0
|
|
69
|
+
[1.0.0]: https://github.com/zzionz/clockbars/releases/tag/v1.0.0
|
|
@@ -4,14 +4,14 @@ type: software
|
|
|
4
4
|
title: clockbars
|
|
5
5
|
authors:
|
|
6
6
|
- alias: zzionz
|
|
7
|
-
version:
|
|
7
|
+
version: 1.0.0
|
|
8
8
|
date-released: "2026-11-27"
|
|
9
9
|
license: MIT
|
|
10
10
|
repository-code: "https://github.com/zzionz/clockbars"
|
|
11
11
|
abstract: >-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Bars on the market's clock: tick, volume, and dollar bars in Polars, one
|
|
13
|
+
call from DataFrame to DataFrame, with a streaming builder held to parity
|
|
14
|
+
with the batch path and session-aware construction.
|
|
15
15
|
keywords:
|
|
16
16
|
- quantitative-finance
|
|
17
17
|
- market-microstructure
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: clockbars
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Bars sampled on the market's own clock: tick, volume, and dollar bars in Polars, batch and streaming with proven parity.
|
|
5
5
|
Project-URL: Homepage, https://github.com/zzionz/clockbars
|
|
6
6
|
Project-URL: Issues, https://github.com/zzionz/clockbars/issues
|
|
@@ -35,9 +35,10 @@ Description-Content-Type: text/markdown
|
|
|
35
35
|
|
|
36
36
|
# clockbars
|
|
37
37
|
|
|
38
|
-
**Bars
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
**Bars on the market's clock.** Every bar closes when a set amount of trading
|
|
39
|
+
has actually happened. Quiet minutes produce nothing, busy ones produce
|
|
40
|
+
plenty. Tick, volume, and dollar bars in Polars, built the same way in batch
|
|
41
|
+
and in a live stream.
|
|
41
42
|
|
|
42
43
|
[](https://github.com/zzionz/clockbars/actions/workflows/ci.yml)
|
|
43
44
|

|
|
@@ -95,7 +96,7 @@ For development:
|
|
|
95
96
|
git clone https://github.com/zzionz/clockbars.git
|
|
96
97
|
cd clockbars
|
|
97
98
|
uv sync --all-extras
|
|
98
|
-
uv run pytest -q #
|
|
99
|
+
uv run pytest -q # 172 passed, 100% coverage enforced
|
|
99
100
|
```
|
|
100
101
|
|
|
101
102
|
CI runs the full gate set on every push: ruff, strict mypy, and the test
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# clockbars
|
|
2
2
|
|
|
3
|
-
**Bars
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
**Bars on the market's clock.** Every bar closes when a set amount of trading
|
|
4
|
+
has actually happened. Quiet minutes produce nothing, busy ones produce
|
|
5
|
+
plenty. Tick, volume, and dollar bars in Polars, built the same way in batch
|
|
6
|
+
and in a live stream.
|
|
6
7
|
|
|
7
8
|
[](https://github.com/zzionz/clockbars/actions/workflows/ci.yml)
|
|
8
9
|

|
|
@@ -60,7 +61,7 @@ For development:
|
|
|
60
61
|
git clone https://github.com/zzionz/clockbars.git
|
|
61
62
|
cd clockbars
|
|
62
63
|
uv sync --all-extras
|
|
63
|
-
uv run pytest -q #
|
|
64
|
+
uv run pytest -q # 172 passed, 100% coverage enforced
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
CI runs the full gate set on every push: ruff, strict mypy, and the test
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "clockbars"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.0"
|
|
8
8
|
description = "Bars sampled on the market's own clock: tick, volume, and dollar bars in Polars, batch and streaming with proven parity."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -199,6 +199,18 @@ def test_tick_threshold_rounds_up(make_trades):
|
|
|
199
199
|
assert bars["n_trades"].to_list() == [3, 3]
|
|
200
200
|
|
|
201
201
|
|
|
202
|
+
def test_tolerance_absorbs_float_accumulation_at_the_threshold(make_trades):
|
|
203
|
+
# Ten 0.1s sum to 0.9999999999999999 in float64, not 1.0. Mathematically
|
|
204
|
+
# the bar filled; a strict `< threshold` comparison would flag a phantom
|
|
205
|
+
# partial bar. The 1e-9 relative tolerance exists for exactly this value,
|
|
206
|
+
# and this test fails if anyone replaces the comparison with a strict one.
|
|
207
|
+
trades = make_trades([10.0] * 10, [0.1] * 10)
|
|
208
|
+
bars = resample(trades, kind="volume", threshold=1.0)
|
|
209
|
+
assert bars.height == 1
|
|
210
|
+
assert bars["n_trades"].to_list() == [10]
|
|
211
|
+
assert bars["is_partial"].to_list() == [False]
|
|
212
|
+
|
|
213
|
+
|
|
202
214
|
def test_tick_threshold_of_one_yields_one_trade_per_bar(trades):
|
|
203
215
|
bars = resample(trades, kind="tick", threshold=1)
|
|
204
216
|
assert bars.height == trades.height
|
|
@@ -82,7 +82,7 @@ wheels = [
|
|
|
82
82
|
|
|
83
83
|
[[package]]
|
|
84
84
|
name = "clockbars"
|
|
85
|
-
version = "0.
|
|
85
|
+
version = "1.0.0"
|
|
86
86
|
source = { editable = "." }
|
|
87
87
|
dependencies = [
|
|
88
88
|
{ name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|