wickra 0.5.8 → 0.5.9

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.
package/README.md CHANGED
@@ -60,77 +60,129 @@ Full documentation lives at **[docs.wickra.org](https://docs.wickra.org)**:
60
60
 
61
61
  ## Why Wickra exists
62
62
 
63
- The Python TA ecosystem has plenty of libraries TA-Lib, pandas-ta, finta,
64
- talipp, tulipy and every one of them shares the same blind spot:
65
-
66
- | Library | Install pain | Streaming | Multi-language | Active |
67
- |------------------------|-----------------|-----------|----------------|--------|
68
- | **★ Wickra** | **clean** | **yes** | **Python + Node + WASM + Rust** | **yes** |
69
- | TA-Lib (Python) | yes (C deps) | no | no | barely |
70
- | pandas-ta | clean | no | no | slow |
71
- | finta | clean | no | no | stale |
72
- | ta-lib-python | yes (C deps) | no | no | barely |
73
- | talipp | clean | yes | no | yes |
74
- | Tulip Indicators | yes (C deps) | no | partial | stale |
75
- | ooples (C#) | clean | no | C# only | yes |
76
-
77
- Wickra is the only library that combines all of: clean install, streaming,
78
- multi-language reach, and active maintenance.
79
-
80
- ## Benchmark: how much faster is "streaming-first"?
81
-
82
- The numbers below were measured on a single developer workstation and are not
83
- guaranteed to reproduce identically on different hardware absolute µs values
84
- depend on CPU, memory clock and OS scheduler. Read them as **relative
85
- speedups** between libraries on identical input, not as a universal
86
- performance contract.
63
+ Wickra started as a personal itch. The existing TA libraries never quite fit the
64
+ projects I was building, so I decided to build one from the ground up partly to
65
+ learn, partly because I genuinely enjoy taking something that already exists and
66
+ trying to do it differently (and, ideally, better). It's open source because the
67
+ useful version of that itch is the one other people can build on too.
68
+
69
+ Plenty of TA libraries are fast. Each one forces a trade-off Wickra does not:
70
+
71
+ | Library | Install | Streaming | Languages | Indicators | Active |
72
+ |------------------|-------------|-------------|-----------------------------|-----------:|--------|
73
+ | **★ Wickra**| **clean** | **yes, O(1)** | **Python · Node · WASM · Rust** | **423** | **yes** |
74
+ | kand | clean | yes | Python · WASM · Rust | ~60 | yes |
75
+ | ta-rs | clean | yes | Rust only | ~30 | stale |
76
+ | yata | clean | partial | Rust only | ~35 | yes |
77
+ | TA-Lib | yes (C deps)| no | many bindings | ~150 | barely |
78
+ | pandas-ta | clean | no | Python | ~130 | slow |
79
+ | finta | clean | no | Python | ~80 | stale |
80
+ | talipp | clean | yes | Python | ~40 | yes |
81
+
82
+ Wickra's edge is **breadth with reach**: 423 indicators that all update in O(1)
83
+ per tick and ship natively to Python, Node.js, WebAssembly and Rust from a
84
+ single engine.
85
+
86
+ **On speed — and why Wickra isn't the fastest.** It deliberately isn't. The
87
+ leaner Rust crates (kand, ta-rs) win several of the micro-benchmarks below, and
88
+ those losses are shown rather than hidden. The gap is a *choice*, not a ceiling:
89
+ every `update` validates its input, runs a real warmup before it emits a value,
90
+ and returns an `Option` so a single bad tick can't silently poison the state.
91
+ ta-rs, by contrast, hands back a bare `f64` from the first tick with no
92
+ validation. If Wickra threw all of that away — raw `f64` out, no checks, no
93
+ warmup contract — it would match or beat the leanest crate on every row. It
94
+ keeps the guarantees instead, and still wins RSI, Bollinger and ATR against kand.
95
+ What no other library matches is the *combination*: catalogue size, native O(1)
96
+ streaming, NaN-safety, and four first-class language targets at once.
97
+
98
+ ## Benchmarks
99
+
100
+ Three comparisons, split by layer and mode. Read them as **relative** speedups
101
+ on identical input — absolute µs depend on CPU, memory clock and OS scheduler,
102
+ not a universal contract.
87
103
 
88
104
  - **Reproduced on:** Windows 11 Pro 26200, AMD Ryzen 9 9950X, 64 GB DDR5,
89
- Rust 1.92 (release profile, `lto = "fat"`, `codegen-units = 1`),
90
- Python 3.12, Node 20.
91
- - **Reproduce yourself:** `pip install -e bindings/python[bench]` then
92
- `python -m benchmarks.compare_libraries`. The script auto-detects every
93
- installed peer library and runs them on the same generated inputs as
94
- Wickra. The CI job `cross-library-bench` runs the same script on every
95
- push and uploads the raw report as a build artefact.
96
-
97
- Lower µs/op = faster. Wickra wins every batch category outright, and the
98
- streaming gap widens linearly with how much history a batch-only library has
99
- to recompute on every tick.
100
-
101
- ### Batch single full pass over a 20 000-bar series
102
-
103
- Reading the table: each cell shows that library's runtime, plus how many times
104
- slower it is than Wickra in parentheses. **★** marks the winner per row.
105
-
106
- | Indicator | **★ Wickra** | finta | talipp |
107
- |---------------------|---------------------|-----------------------------|-------------------------------|
108
- | SMA(20) | **95.6 µs ★** | 343.5 µs (3.6× slower) | 7 640.6 µs (79.9× slower) |
109
- | EMA(20) | **64.6 µs ★** | 223.1 µs (3.5× slower) | 12 160.9 µs (188.2× slower) |
110
- | RSI(14) | **126.2 µs ★** | 1 107.1 µs (8.8× slower) | 15 792.2 µs (125.1× slower) |
111
- | MACD(12, 26, 9) | **119.0 µs ★** | 531.8 µs (4.5× slower) | 49 788.1 µs (418.2× slower) |
112
- | Bollinger(20, 2.0) | **105.3 µs ★** | 812.0 µs (7.7× slower) | 130 938.3 µs (1 243.7× slower)|
113
- | ATR(14) | **123.5 µs ★** | 5 144.8 µs (41.7× slower) | 28 816.0 µs (233.4× slower) |
114
-
115
- ### Streaming per-tick latency after seeding with 5 000 historical bars
116
-
117
- A batch-only library has to re-run its full indicator over the entire history on
118
- every new tick; Wickra updates state in O(1).
119
-
120
- | Indicator | **★ Wickra (per tick)** | talipp (per tick) |
121
- |-----------|---------------------|---------------------------|
122
- | RSI(14) | **0.119 µs ★** | 1.644 µs (13.8× slower) |
123
-
124
- > TA-Lib and pandas-ta are not included here because both fail to install
125
- > cleanly on Windows without C build tooling which is precisely the install
126
- > pain Wickra was built to remove. The benchmark script auto-detects every
127
- > peer library it can find and runs them on the same inputs as Wickra; install
128
- > them in your environment to see those rows light up too.
105
+ Rust 1.92 (release: `lto = "fat"`, `codegen-units = 1`), Python 3.12.
106
+ - **Reproduce yourself:**
107
+ - Rust core vs Rust crates: `cargo bench -p wickra-bench`
108
+ - Python vs Python libs: `pip install -e bindings/python[bench]` then
109
+ `python -m benchmarks.compare_libraries` (auto-detects installed peers).
110
+
111
+ ### 1. Rust core vs the other Rust TA crates
112
+
113
+ Like-for-like, no language-binding overhead, over a 50 000-bar series (µs for
114
+ the whole series, lower = faster). This is the honest engine comparison —
115
+ Wickra wins some and loses some, and both are shown.
116
+
117
+ **Streaming** (one value fed per `update`):
118
+
119
+ | Indicator | **★ Wickra** | kand | ta-rs | yata |
120
+ |------------------|------------------:|-----:|------:|-----:|
121
+ | SMA(20) | 50 | 38 | 47 | 38 |
122
+ | EMA(20) | 154 | 69 | 56 | 69 |
123
+ | RSI(14) | 164 | 216 | 74 | — |
124
+ | MACD(12, 26, 9) | 275 | 143 | 66 | |
125
+ | Bollinger(20, 2) | **128 ★** | 248 | 168 | — |
126
+ | ATR(14) | 152 | 166 | 61 | |
127
+
128
+ **Batch** (whole series at once). Only Wickra and kand expose a batch API;
129
+ ta-rs and yata are streaming-only.
130
+
131
+ | Indicator | **★ Wickra** | kand |
132
+ |------------------|------------------:|-----:|
133
+ | SMA(20) | 82 | 42 |
134
+ | EMA(20) | 159 | 74 |
135
+ | RSI(14) | **253 ★** | 274 |
136
+ | MACD(12, 26, 9) | 681 | 283 |
137
+ | Bollinger(20, 2) | **445 ★** | 462 |
138
+ | ATR(14) | 175 | 173 |
139
+
140
+ ta-rs is the per-indicator speed champion on almost every row it returns a
141
+ bare `f64` with no warmup state and no input validation, trading away the
142
+ `None`-warmup and NaN-safety semantics Wickra keeps. Against kand, Wickra wins
143
+ streaming RSI, Bollinger and ATR (and batch RSI + Bollinger); Bollinger is the
144
+ one row where Wickra is the outright fastest of all four. The leaner crates
145
+ still win the pure recurrences (EMA, MACD) and SMA. yata exposes only SMA/EMA as
146
+ raw-value methods, so its other rows are omitted rather than faked.
147
+
148
+ ### 2. Python vs the Python TA ecosystem — batch
149
+
150
+ Full pass over a 20 000-bar series, µs/op (lower = faster). **★** per row.
151
+
152
+ | Indicator | **★ Wickra** | finta | TA-Lib | tulipy |
153
+ |------------------|------------------:|---------------------|--------|--------|
154
+ | SMA(20) | **59.6 ★** | 354.2 (5.9× slower) | ⧗ | ⧗ |
155
+ | EMA(20) | **88.4 ★** | 309.3 (3.5× slower) | ⧗ | ⧗ |
156
+ | RSI(14) | **77.3 ★** | 1 283 (16.6× slower)| ⧗ | ⧗ |
157
+ | MACD(12, 26, 9) | **116.4 ★** | 529.5 (4.6× slower) | ⧗ | ⧗ |
158
+ | Bollinger(20, 2) | **146.0 ★** | 1 246 (8.5× slower) | ⧗ | ⧗ |
159
+ | ATR(14) | **135.8 ★** | 3 812 (28× slower) | ⧗ | ⧗ |
160
+
161
+ > ⧗ = published by the CI Linux job. TA-Lib and tulipy ship C extensions that
162
+ > don't build cleanly on every desktop, so their canonical numbers come from the
163
+ > `cross-library-bench` workflow rather than this local table. pandas-ta needs
164
+ > Python ≥ 3.12 and isn't in the 3.11 CI matrix. The script auto-detects
165
+ > whichever peers are installed in your environment.
166
+
167
+ ### 3. Python — streaming (per-tick latency)
168
+
169
+ Seed 5 000 bars, then feed ticks one at a time. talipp is the only Python peer
170
+ with a true incremental API; batch-only libraries like TA-Lib must recompute the
171
+ entire history on every tick — Wickra updates in O(1).
172
+
173
+ | Indicator | **★ Wickra (per tick)** | talipp (per tick) |
174
+ |------------------|------------------------------:|-------------------------|
175
+ | SMA(20) | **0.067 µs ★** | 0.63 µs (9.4× slower) |
176
+ | EMA(20) | **0.051 µs ★** | 0.63 µs (12.2× slower) |
177
+ | RSI(14) | **0.053 µs ★** | 1.00 µs (19.1× slower) |
178
+ | MACD(12, 26, 9) | **0.071 µs ★** | 3.64 µs (51.5× slower) |
179
+ | Bollinger(20, 2) | **0.085 µs ★** | 4.87 µs (57.2× slower) |
129
180
 
130
181
  Run the suite yourself:
131
182
 
132
183
  ```bash
133
- pip install -e bindings/python[bench]
184
+ cargo bench -p wickra-bench # Rust core vs kand / ta-rs / yata
185
+ pip install -e bindings/python[bench] # Python peers
134
186
  python -m benchmarks.compare_libraries
135
187
  ```
136
188
 
@@ -247,7 +299,8 @@ wickra/
247
299
  ├── crates/
248
300
  │ ├── wickra-core/ core engine + all 423 indicators
249
301
  │ ├── wickra/ top-level facade crate (publishes on crates.io) + benches/
250
- └── wickra-data/ CSV reader, tick aggregator, live exchange feeds
302
+ ├── wickra-data/ CSV reader, tick aggregator, live exchange feeds
303
+ │ └── wickra-bench/ internal cross-library benchmark harness (not published)
251
304
  ├── bindings/
252
305
  │ ├── python/ PyO3 + maturin (publishes on PyPI)
253
306
  │ ├── node/ napi-rs (publishes on npm)
@@ -261,9 +314,10 @@ wickra/
261
314
  └── .github/workflows/ CI and release pipelines
262
315
  ```
263
316
 
264
- Rust benchmarks live in `crates/wickra/benches/`; runnable Rust examples live
265
- in the workspace member crate at `examples/rust/`. There is no top-level
266
- `benches/` directory.
317
+ Wickra's own regression benchmarks live in `crates/wickra/benches/`; the
318
+ cross-library comparison against kand, ta-rs and yata lives in the internal
319
+ `crates/wickra-bench/` crate. Runnable Rust examples live in the workspace member
320
+ crate at `examples/rust/`. There is no top-level `benches/` directory.
267
321
 
268
322
  ## Building everything from source
269
323
 
@@ -271,7 +325,8 @@ in the workspace member crate at `examples/rust/`. There is no top-level
271
325
  # Rust core + tests
272
326
  cargo test --workspace
273
327
  cargo clippy --workspace --all-targets -- -D warnings
274
- cargo bench -p wickra
328
+ cargo bench -p wickra # Wickra's own regression benchmarks
329
+ cargo bench -p wickra-bench # cross-library comparison (kand, ta-rs, yata)
275
330
 
276
331
  # Python binding (requires Rust toolchain + maturin)
277
332
  cd bindings/python
@@ -371,3 +426,10 @@ The library is provided **as is**, without warranty of any kind; see
371
426
  <p align="center">
372
427
  If Wickra saved you time, the cheapest way to say thanks is to ⭐ the repo.
373
428
  </p>
429
+
430
+ <p align="center">
431
+ <a href="https://github.com/wickra-lib/wickra">
432
+ <img alt="Star Wickra on GitHub"
433
+ src="https://img.shields.io/badge/%E2%AD%90%20Star%20Wickra%20on%20GitHub-1f2328?style=for-the-badge&logo=github&logoColor=ffd866&labelColor=1f2328">
434
+ </a>
435
+ </p>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-darwin-arm64",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (macOS Apple Silicon). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.darwin-arm64.node",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-darwin-x64",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (macOS Intel). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.darwin-x64.node",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-linux-arm64-gnu",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (linux arm64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.linux-arm64-gnu.node",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-linux-x64-gnu",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (linux x64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.linux-x64-gnu.node",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-win32-arm64-msvc",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (Windows arm64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.win32-arm64-msvc.node",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra-win32-x64-msvc",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Native binding for wickra (Windows x64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
5
5
  "main": "wickra.win32-x64-msvc.node",
6
6
  "files": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickra",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
5
5
  "author": "kingchenc <support@wickra.org>",
6
6
  "main": "index.js",
@@ -47,12 +47,12 @@
47
47
  "node": ">= 18"
48
48
  },
49
49
  "optionalDependencies": {
50
- "wickra-linux-x64-gnu": "0.5.8",
51
- "wickra-linux-arm64-gnu": "0.5.8",
52
- "wickra-darwin-x64": "0.5.8",
53
- "wickra-darwin-arm64": "0.5.8",
54
- "wickra-win32-x64-msvc": "0.5.8",
55
- "wickra-win32-arm64-msvc": "0.5.8"
50
+ "wickra-linux-x64-gnu": "0.5.9",
51
+ "wickra-linux-arm64-gnu": "0.5.9",
52
+ "wickra-darwin-x64": "0.5.9",
53
+ "wickra-darwin-arm64": "0.5.9",
54
+ "wickra-win32-x64-msvc": "0.5.9",
55
+ "wickra-win32-arm64-msvc": "0.5.9"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "napi build --platform --release",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file