flowbars 0.1.0__py3-none-any.whl
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.
- flowbars/__init__.py +163 -0
- flowbars/_version.py +8 -0
- flowbars/adapters/__init__.py +29 -0
- flowbars/adapters/polars.py +1115 -0
- flowbars/bars/__init__.py +3 -0
- flowbars/bars/accumulators.py +731 -0
- flowbars/bars/constructor.py +1254 -0
- flowbars/bars/information/__init__.py +41 -0
- flowbars/bars/information/imbalance_dollar_bars.py +200 -0
- flowbars/bars/information/imbalance_tick_bars.py +206 -0
- flowbars/bars/information/imbalance_volume_bars.py +200 -0
- flowbars/bars/information/run_dollar_bars.py +225 -0
- flowbars/bars/information/run_tick_bars.py +231 -0
- flowbars/bars/information/run_volume_bars.py +225 -0
- flowbars/bars/minute/__init__.py +99 -0
- flowbars/bars/minute/accumulators.py +303 -0
- flowbars/bars/minute/engine.py +244 -0
- flowbars/bars/minute/information.py +622 -0
- flowbars/bars/minute/numba.py +1043 -0
- flowbars/bars/minute/registry.py +22 -0
- flowbars/bars/minute/standard.py +261 -0
- flowbars/bars/minute/structural.py +474 -0
- flowbars/bars/numba_backend.py +1227 -0
- flowbars/bars/output.py +106 -0
- flowbars/bars/registry.py +47 -0
- flowbars/bars/spec.py +367 -0
- flowbars/bars/standard/__init__.py +17 -0
- flowbars/bars/standard/dollar_bars.py +168 -0
- flowbars/bars/standard/tick_bars.py +166 -0
- flowbars/bars/standard/time_bars.py +192 -0
- flowbars/bars/standard/volume_bars.py +168 -0
- flowbars/benchmarks.py +420 -0
- flowbars/calendars.py +368 -0
- flowbars/core.py +109 -0
- flowbars/py.typed +0 -0
- flowbars/quality.py +393 -0
- flowbars/sample_data/__init__.py +28 -0
- flowbars/sample_data/tick_data.csv +501 -0
- flowbars/schema.py +476 -0
- flowbars/thresholds.py +1167 -0
- flowbars/tick_rule.py +89 -0
- flowbars-0.1.0.dist-info/METADATA +650 -0
- flowbars-0.1.0.dist-info/RECORD +46 -0
- flowbars-0.1.0.dist-info/WHEEL +5 -0
- flowbars-0.1.0.dist-info/licenses/LICENSE +21 -0
- flowbars-0.1.0.dist-info/top_level.txt +1 -0
flowbars/__init__.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""flowbars — production-grade bar construction for financial ML.
|
|
2
|
+
|
|
3
|
+
Standard bars: time, tick, volume, dollar.
|
|
4
|
+
Information-driven bars: imbalance, run (tick, volume, dollar variants).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# Public API — batch convenience functions (populated as bar types are registered)
|
|
8
|
+
from flowbars._version import __version__ # noqa: F401
|
|
9
|
+
from flowbars.bars.constructor import BaseBarConstructor, params_hash
|
|
10
|
+
from flowbars.bars.information import ( # noqa: F401 — triggers @register_bar side-effects
|
|
11
|
+
ImbalanceDollarBarConstructor,
|
|
12
|
+
ImbalanceTickBarConstructor,
|
|
13
|
+
ImbalanceVolumeBarConstructor,
|
|
14
|
+
RunDollarBarConstructor,
|
|
15
|
+
RunTickBarConstructor,
|
|
16
|
+
RunVolumeBarConstructor,
|
|
17
|
+
compute_imbalance_dollar_bars,
|
|
18
|
+
compute_imbalance_tick_bars,
|
|
19
|
+
compute_imbalance_volume_bars,
|
|
20
|
+
compute_run_dollar_bars,
|
|
21
|
+
compute_run_tick_bars,
|
|
22
|
+
compute_run_volume_bars,
|
|
23
|
+
)
|
|
24
|
+
from flowbars.bars.minute import ( # noqa: F401 — triggers minute registration
|
|
25
|
+
BaseMinuteBarConstructor,
|
|
26
|
+
MinuteBarRegistry,
|
|
27
|
+
MinuteDollarAccumulator,
|
|
28
|
+
MinuteDollarBarConstructor,
|
|
29
|
+
MinuteHybridAccumulator,
|
|
30
|
+
MinuteHybridBarConstructor,
|
|
31
|
+
MinuteImbalanceAccumulator,
|
|
32
|
+
MinuteImbalanceDollarBarConstructor,
|
|
33
|
+
MinuteImbalanceVolumeBarConstructor,
|
|
34
|
+
MinuteRangeAccumulator,
|
|
35
|
+
MinuteRangeBarConstructor,
|
|
36
|
+
MinuteRenkoAccumulator,
|
|
37
|
+
MinuteRenkoBarConstructor,
|
|
38
|
+
MinuteRunAccumulator,
|
|
39
|
+
MinuteRunDollarBarConstructor,
|
|
40
|
+
MinuteRunVolumeBarConstructor,
|
|
41
|
+
MinuteVolatilityAccumulator,
|
|
42
|
+
MinuteVolatilityBarConstructor,
|
|
43
|
+
MinuteVolumeAccumulator,
|
|
44
|
+
MinuteVolumeBarConstructor,
|
|
45
|
+
compute_dollar_bars_from_minutes,
|
|
46
|
+
compute_hybrid_bars_from_minutes,
|
|
47
|
+
compute_imbalance_dollar_bars_from_minutes,
|
|
48
|
+
compute_imbalance_volume_bars_from_minutes,
|
|
49
|
+
compute_range_bars_from_minutes,
|
|
50
|
+
compute_renko_bars_from_minutes,
|
|
51
|
+
compute_run_dollar_bars_from_minutes,
|
|
52
|
+
compute_run_volume_bars_from_minutes,
|
|
53
|
+
compute_volatility_bars_from_minutes,
|
|
54
|
+
compute_volume_bars_from_minutes,
|
|
55
|
+
)
|
|
56
|
+
from flowbars.bars.output import validate_bar_frame
|
|
57
|
+
from flowbars.bars.registry import BarRegistry
|
|
58
|
+
from flowbars.bars.spec import BarTypeSpec
|
|
59
|
+
from flowbars.bars.standard import ( # noqa: F401 — triggers @register_bar side-effects
|
|
60
|
+
DollarBarConstructor,
|
|
61
|
+
TickBarConstructor,
|
|
62
|
+
TimeBarConstructor,
|
|
63
|
+
VolumeBarConstructor,
|
|
64
|
+
compute_dollar_bars,
|
|
65
|
+
compute_tick_bars,
|
|
66
|
+
compute_time_bars,
|
|
67
|
+
compute_volume_bars,
|
|
68
|
+
)
|
|
69
|
+
from flowbars.calendars import (
|
|
70
|
+
ContinuousCalendar,
|
|
71
|
+
ExchangeCalendar,
|
|
72
|
+
SessionCalendar,
|
|
73
|
+
TradingCalendar,
|
|
74
|
+
WeekdayCalendar,
|
|
75
|
+
)
|
|
76
|
+
from flowbars.core import BarContractError
|
|
77
|
+
|
|
78
|
+
# Re-export the bar quality report
|
|
79
|
+
from flowbars.quality import bar_quality_report
|
|
80
|
+
|
|
81
|
+
# Sample data loader
|
|
82
|
+
from flowbars.sample_data import load_sample_data
|
|
83
|
+
from flowbars.schema import MinuteSchemaMapping, SchemaMapping
|
|
84
|
+
from flowbars.thresholds import (
|
|
85
|
+
EWMAThresholdEstimator,
|
|
86
|
+
MinuteCalibrationHelper,
|
|
87
|
+
StaticCalibrationHelper,
|
|
88
|
+
StaticThresholdEstimator,
|
|
89
|
+
ThresholdEstimator,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
__all__ = [
|
|
93
|
+
"BarContractError",
|
|
94
|
+
"BarRegistry",
|
|
95
|
+
"BarTypeSpec",
|
|
96
|
+
"BaseBarConstructor",
|
|
97
|
+
"BaseMinuteBarConstructor",
|
|
98
|
+
"ContinuousCalendar",
|
|
99
|
+
"DollarBarConstructor",
|
|
100
|
+
"ExchangeCalendar",
|
|
101
|
+
"EWMAThresholdEstimator",
|
|
102
|
+
"ImbalanceDollarBarConstructor",
|
|
103
|
+
"ImbalanceTickBarConstructor",
|
|
104
|
+
"ImbalanceVolumeBarConstructor",
|
|
105
|
+
"MinuteBarRegistry",
|
|
106
|
+
"MinuteCalibrationHelper",
|
|
107
|
+
"MinuteDollarAccumulator",
|
|
108
|
+
"MinuteDollarBarConstructor",
|
|
109
|
+
"MinuteHybridAccumulator",
|
|
110
|
+
"MinuteHybridBarConstructor",
|
|
111
|
+
"MinuteImbalanceAccumulator",
|
|
112
|
+
"MinuteImbalanceDollarBarConstructor",
|
|
113
|
+
"MinuteImbalanceVolumeBarConstructor",
|
|
114
|
+
"MinuteRangeAccumulator",
|
|
115
|
+
"MinuteRangeBarConstructor",
|
|
116
|
+
"MinuteRenkoAccumulator",
|
|
117
|
+
"MinuteRenkoBarConstructor",
|
|
118
|
+
"MinuteRunAccumulator",
|
|
119
|
+
"MinuteRunDollarBarConstructor",
|
|
120
|
+
"MinuteRunVolumeBarConstructor",
|
|
121
|
+
"MinuteSchemaMapping",
|
|
122
|
+
"MinuteVolatilityAccumulator",
|
|
123
|
+
"MinuteVolatilityBarConstructor",
|
|
124
|
+
"MinuteVolumeAccumulator",
|
|
125
|
+
"MinuteVolumeBarConstructor",
|
|
126
|
+
"RunDollarBarConstructor",
|
|
127
|
+
"RunTickBarConstructor",
|
|
128
|
+
"RunVolumeBarConstructor",
|
|
129
|
+
"SchemaMapping",
|
|
130
|
+
"SessionCalendar",
|
|
131
|
+
"StaticCalibrationHelper",
|
|
132
|
+
"StaticThresholdEstimator",
|
|
133
|
+
"ThresholdEstimator",
|
|
134
|
+
"TickBarConstructor",
|
|
135
|
+
"TimeBarConstructor",
|
|
136
|
+
"TradingCalendar",
|
|
137
|
+
"VolumeBarConstructor",
|
|
138
|
+
"WeekdayCalendar",
|
|
139
|
+
"bar_quality_report",
|
|
140
|
+
"load_sample_data",
|
|
141
|
+
"params_hash",
|
|
142
|
+
"validate_bar_frame",
|
|
143
|
+
"compute_dollar_bars",
|
|
144
|
+
"compute_dollar_bars_from_minutes",
|
|
145
|
+
"compute_hybrid_bars_from_minutes",
|
|
146
|
+
"compute_imbalance_dollar_bars",
|
|
147
|
+
"compute_imbalance_dollar_bars_from_minutes",
|
|
148
|
+
"compute_imbalance_tick_bars",
|
|
149
|
+
"compute_imbalance_volume_bars",
|
|
150
|
+
"compute_imbalance_volume_bars_from_minutes",
|
|
151
|
+
"compute_range_bars_from_minutes",
|
|
152
|
+
"compute_renko_bars_from_minutes",
|
|
153
|
+
"compute_run_dollar_bars",
|
|
154
|
+
"compute_run_dollar_bars_from_minutes",
|
|
155
|
+
"compute_run_tick_bars",
|
|
156
|
+
"compute_run_volume_bars",
|
|
157
|
+
"compute_run_volume_bars_from_minutes",
|
|
158
|
+
"compute_tick_bars",
|
|
159
|
+
"compute_time_bars",
|
|
160
|
+
"compute_volatility_bars_from_minutes",
|
|
161
|
+
"compute_volume_bars",
|
|
162
|
+
"compute_volume_bars_from_minutes",
|
|
163
|
+
]
|
flowbars/_version.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Single source of truth for the flowbars package version.
|
|
2
|
+
|
|
3
|
+
Kept in its own module so that internal code (state serialization, registry
|
|
4
|
+
metadata) can import it without triggering the package ``__init__`` and its
|
|
5
|
+
circular imports.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""I/O adapters. Currently: polars.
|
|
2
|
+
Adapters are batch-only — no streaming equivalent.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from flowbars.adapters.polars import (
|
|
6
|
+
compute_dollar_bars,
|
|
7
|
+
compute_imbalance_dollar_bars,
|
|
8
|
+
compute_imbalance_tick_bars,
|
|
9
|
+
compute_imbalance_volume_bars,
|
|
10
|
+
compute_run_dollar_bars,
|
|
11
|
+
compute_run_tick_bars,
|
|
12
|
+
compute_run_volume_bars,
|
|
13
|
+
compute_tick_bars,
|
|
14
|
+
compute_time_bars,
|
|
15
|
+
compute_volume_bars,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"compute_dollar_bars",
|
|
20
|
+
"compute_imbalance_dollar_bars",
|
|
21
|
+
"compute_imbalance_tick_bars",
|
|
22
|
+
"compute_imbalance_volume_bars",
|
|
23
|
+
"compute_run_dollar_bars",
|
|
24
|
+
"compute_run_tick_bars",
|
|
25
|
+
"compute_run_volume_bars",
|
|
26
|
+
"compute_tick_bars",
|
|
27
|
+
"compute_time_bars",
|
|
28
|
+
"compute_volume_bars",
|
|
29
|
+
]
|