wickra-wasm 0.9.1 → 0.9.3
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 +72 -24
- package/package.json +1 -1
- package/wickra_wasm.d.ts +585 -9
- package/wickra_wasm.js +1 -1
- package/wickra_wasm_bg.js +10051 -71
- package/wickra_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
[](https://www.bestpractices.dev/projects/13094)
|
|
19
19
|
[](https://github.com/wickra-lib/wickra/attestations)
|
|
20
20
|
[](https://docs.wickra.org)
|
|
21
|
+
[](https://docs.wickra.org/FAQ#do-all-the-language-bindings-compute-the-same-values)
|
|
21
22
|
|
|
22
|
-
**Streaming-first technical indicators. Install with `pip install wickra` — no system dependencies.**
|
|
23
|
+
**Streaming-first technical indicators. Install with `pip install wickra` — no system dependencies, zero third-party packages.**
|
|
23
24
|
|
|
24
25
|
Wickra is a multi-language technical-analysis library with a Rust core and
|
|
25
26
|
native bindings for Python, Node.js and WASM, plus a C ABI that C, C++,
|
|
@@ -28,13 +29,13 @@ state machine that updates in O(1) per new data point, so live trading bots and
|
|
|
28
29
|
historical backtests share the exact same implementation.
|
|
29
30
|
|
|
30
31
|
```python
|
|
31
|
-
import
|
|
32
|
-
import wickra as ta
|
|
32
|
+
import wickra as ta # zero third-party deps — not even NumPy
|
|
33
33
|
|
|
34
34
|
# Batch: classic TA-Lib-style usage
|
|
35
|
-
prices =
|
|
35
|
+
prices = [100.0 + i * 0.1 for i in range(1000)]
|
|
36
36
|
rsi = ta.RSI(14)
|
|
37
|
-
values = rsi.batch(prices) #
|
|
37
|
+
values = rsi.batch(prices) # array.array('d'), NaN during warmup
|
|
38
|
+
# np.asarray(values) wraps it zero-copy if you use NumPy
|
|
38
39
|
|
|
39
40
|
# Streaming: same indicator, fed tick by tick
|
|
40
41
|
rsi = ta.RSI(14)
|
|
@@ -53,6 +54,7 @@ Full documentation lives at **[docs.wickra.org](https://docs.wickra.org)**:
|
|
|
53
54
|
[Node](https://docs.wickra.org/Quickstart-Node),
|
|
54
55
|
[WASM](https://docs.wickra.org/Quickstart-WASM),
|
|
55
56
|
[C](https://docs.wickra.org/Quickstart-C),
|
|
57
|
+
[C++](https://docs.wickra.org/Quickstart-C),
|
|
56
58
|
[C#](https://docs.wickra.org/Quickstart-CSharp),
|
|
57
59
|
[Go](https://docs.wickra.org/Quickstart-Go),
|
|
58
60
|
[Java](https://docs.wickra.org/Quickstart-Java),
|
|
@@ -89,6 +91,11 @@ times to get there.
|
|
|
89
91
|
runs a real warmup, and returns an `Option` so a single bad tick can't silently
|
|
90
92
|
poison state. `batch == streaming` is **bit-exact, fuzzed and 100 %-line-covered
|
|
91
93
|
for all 514 indicators**.
|
|
94
|
+
- **Identical across every language — proven, not promised.** All 514 indicators
|
|
95
|
+
are replayed through **all 10 languages** (Rust · Python · Node.js · WASM · C ·
|
|
96
|
+
C++ · C# · Go · Java · R) and checked **bit-for-bit against the Rust reference**
|
|
97
|
+
via shared golden fixtures in CI. The math is verifiably the same everywhere —
|
|
98
|
+
this very check caught and fixed two real cross-language marshalling bugs.
|
|
92
99
|
- **Orders of magnitude faster where it counts.** In streaming Wickra is **11–56×**
|
|
93
100
|
faster than the only other incremental peer and **thousands of times** faster
|
|
94
101
|
than recompute-on-every-tick libraries. On batch it wins several rows outright
|
|
@@ -97,8 +104,13 @@ times to get there.
|
|
|
97
104
|
- **Install in one line, anywhere.** `pip install wickra` / `npm install wickra` —
|
|
98
105
|
precompiled wheels and binaries, **no C toolchain, none of TA-Lib's setup pain**.
|
|
99
106
|
macOS · Linux · Windows.
|
|
100
|
-
- **Batteries included
|
|
101
|
-
|
|
107
|
+
- **Batteries included — zero third-party deps, in every language.** A full native
|
|
108
|
+
data layer ships in the box: a CSV candle reader, a tick-to-candle aggregator, a
|
|
109
|
+
timeframe resampler, a live Binance WebSocket feed and a historical Binance REST
|
|
110
|
+
fetcher — in **all 10 languages**. Loading a CSV, rolling ticks into candles,
|
|
111
|
+
resampling and streaming live data needs **no foreign package** — no pandas, no
|
|
112
|
+
`csv-parse`, no `ws`/`websockets`, no `jackson`, no `jsonlite`, not even NumPy.
|
|
113
|
+
`pip install wickra` / `npm install wickra` / `go get` / … pulls **nothing else**.
|
|
102
114
|
- **Truly permissive.** **MIT OR Apache-2.0** — drop it straight into commercial
|
|
103
115
|
and closed-source work.
|
|
104
116
|
|
|
@@ -137,12 +149,38 @@ elsewhere for `None`-warmup, NaN-safety and bit-exact `batch == streaming`.
|
|
|
137
149
|
Full tables (Rust + Python, streaming + batch) and how to reproduce them live in
|
|
138
150
|
**[BENCHMARKS.md](BENCHMARKS.md)**.
|
|
139
151
|
|
|
152
|
+
### Pick your language with eyes open — per-binding throughput
|
|
153
|
+
|
|
154
|
+
Every binding calls the **same** Rust core, so this is **not** a speed claim — it
|
|
155
|
+
is the raw cost of crossing each language's FFI boundary (`SMA(20)`, 200 000 bars,
|
|
156
|
+
Ryzen 9 9950X, million updates/sec). **Batch stays high for most bindings;
|
|
157
|
+
streaming is where the boundary shows** — so if you stream tick-by-tick, the table
|
|
158
|
+
tells you which binding keeps up and which to avoid for hot loops.
|
|
159
|
+
|
|
160
|
+
| Language | streaming (Mupd/s) | batch (Mupd/s) |
|
|
161
|
+
|-----------------|-------------------:|---------------:|
|
|
162
|
+
| Rust (no FFI) | 380 | 498 |
|
|
163
|
+
| C / C++ | 365 | 358 |
|
|
164
|
+
| C# | 348 | 259 |
|
|
165
|
+
| Python | 31 | 46 |
|
|
166
|
+
| Java | 38 | 173 |
|
|
167
|
+
| Go | 23 | 394 |
|
|
168
|
+
| WASM | 21 | 169 |
|
|
169
|
+
| Node.js | 16 | 9 |
|
|
170
|
+
| R | 0.1 | 279 |
|
|
171
|
+
|
|
172
|
+
All ten share one verified implementation (see the verification badge above), so
|
|
173
|
+
the *numbers* differ but the *values* are bit-for-bit identical. Methodology and
|
|
174
|
+
the per-indicator breakdown are in [BENCHMARKS.md](BENCHMARKS.md#3-per-binding-throughput--the-cost-of-the-boundary).
|
|
175
|
+
|
|
140
176
|
## Indicators
|
|
141
177
|
|
|
142
178
|
514 streaming-first indicators across twenty-four families. Every one passes the
|
|
143
179
|
`batch == streaming` equivalence test, reference-value tests, and reset
|
|
144
|
-
semantics tests
|
|
145
|
-
|
|
180
|
+
semantics tests — and is replayed through **all 10 languages** and checked
|
|
181
|
+
bit-for-bit against the Rust reference (golden fixtures, in CI). Each has a
|
|
182
|
+
per-indicator deep dive (formula, parameters, warmup) at
|
|
183
|
+
[docs.wickra.org](https://docs.wickra.org/Indicators-Overview).
|
|
146
184
|
|
|
147
185
|
| Family | Indicators |
|
|
148
186
|
|--------|-----------|
|
|
@@ -153,7 +191,7 @@ warmup) at [docs.wickra.org](https://docs.wickra.org/Indicators-Overview).
|
|
|
153
191
|
| Volatility & Bands | ATR, Bollinger Bands, Keltner Channels, Donchian Channels, NATR, StdDev, Ulcer Index, Historical Volatility, Bollinger Bandwidth, %B, True Range, Chaikin Volatility, RVI (Relative Volatility Index), Parkinson Volatility, Garman-Klass Volatility, Rogers-Satchell Volatility, Yang-Zhang Volatility, Volatility Cone |
|
|
154
192
|
| Bands & Channels | MA Envelope, Acceleration Bands, STARC Bands, ATR Bands, Hurst Channel, LinReg Channel, Standard Error Bands, Double Bollinger Bands, TTM Squeeze, Fractal Chaos Bands, VWAP StdDev Bands, Quartile Bands, Bomar Bands, Median Channel, Projection Bands, Projection Oscillator |
|
|
155
193
|
| Trailing Stops | Parabolic SAR, Parabolic SAR Extended (SAREXT), SuperTrend, Chandelier Exit, Chande Kroll Stop, ATR Trailing Stop, HiLo Activator, Volty Stop, Yo-Yo Exit, Donchian Channel Stop, Percentage Trailing Stop, Step Trailing Stop, Renko Trailing Stop, Kase DevStop, Elder SafeZone, ATR Ratchet, NRTR, Time-Based Stop, Modified MA Stop |
|
|
156
|
-
| Volume | OBV, VWAP (cumulative + rolling), ADL, Volume-Price Trend, Chaikin Money Flow, Chaikin Oscillator, Force Index, Ease of Movement, Klinger Volume Oscillator, Volume Oscillator, NVI, PVI, Williams A/D, Anchored VWAP, Demand Index, TSV, VZO, Market Facilitation Index, Volume RSI, Williams Accumulation/Distribution, Twiggs Money Flow, Trade Volume Index, Intraday Intensity
|
|
194
|
+
| Volume | OBV, VWAP (cumulative + rolling), ADL, Volume-Price Trend, Chaikin Money Flow, Chaikin Oscillator, Force Index, Ease of Movement, Klinger Volume Oscillator, Volume Oscillator, NVI, PVI, Williams A/D Oscillator, Anchored VWAP, Demand Index, TSV, VZO, Market Facilitation Index, Volume RSI, Williams Accumulation/Distribution, Twiggs Money Flow, Trade Volume Index, Intraday Intensity, Better Volume, Volume-Weighted MACD |
|
|
157
195
|
| Price Statistics | Typical Price, Median Price, Weighted Close, Linear Regression, Linear Regression Slope, Z-Score, Linear Regression Angle, Variance, Coefficient of Variation, Skewness, Kurtosis, Standard Error, Detrended StdDev, R², Median Absolute Deviation, Autocorrelation, Hurst Exponent, Pearson Correlation, Beta, Pairwise Beta, Pair Spread Z-Score, Lead-Lag Cross-Correlation, Cointegration, Relative Strength A-vs-B, Spearman Correlation, Mid Price, Mid Point, Average Price, Linear Regression Intercept, Time Series Forecast, Rolling Correlation, Rolling Covariance, OU Half-Life, Spread Hurst, Distance SSD, Beta-Neutral Spread, Variance Ratio, Granger Causality, Kalman Hedge Ratio, Spread Bollinger Bands, Spread AR(1) Coefficient, Jarque-Bera, Rolling Min-Max Scaler, Shannon Entropy, Sample Entropy, Kendall Tau |
|
|
158
196
|
| Ehlers / Cycle (DSP) | MAMA, FAMA, Fisher Transform, Inverse Fisher Transform, SuperSmoother, Hilbert Dominant Cycle, Hilbert Phasor, Hilbert DC Phase, Hilbert Trend Mode, Sine Wave, Decycler, Decycler Oscillator, Roofing Filter, Center of Gravity, Cybernetic Cycle, Adaptive Cycle, Empirical Mode Decomposition, Ehlers Stochastic, Instantaneous Trendline, Highpass Filter, Reflex, Trendflex, Correlation Trend Indicator, Adaptive RSI, Universal Oscillator, Adaptive CCI, Bandpass Filter, Even Better Sinewave, Autocorrelation Periodogram |
|
|
159
197
|
| Pivots & S/R | Classic Pivots, Fibonacci Pivots, Camarilla, Woodie Pivots, DeMark Pivots, Williams Fractals, ZigZag, Central Pivot Range, Murrey Math Lines, Andrews Pitchfork, Volume-Weighted Support/Resistance, Pivot Reversal |
|
|
@@ -248,12 +286,17 @@ chain.update(price);
|
|
|
248
286
|
|
|
249
287
|
## Live data sources
|
|
250
288
|
|
|
251
|
-
|
|
289
|
+
Wickra ships a complete, **native data layer** — exposed in **all 10 languages**,
|
|
290
|
+
pulling **zero third-party packages** (no pandas / `csv-parse` / `ws` / `jackson`
|
|
291
|
+
/ `jsonlite`). In Rust it lives in the `wickra-data` crate; every binding exposes
|
|
292
|
+
the same building blocks:
|
|
252
293
|
|
|
253
|
-
- A streaming OHLCV **CSV reader
|
|
254
|
-
- A **tick-to-candle aggregator** with arbitrary timeframes.
|
|
255
|
-
- A **candle resampler** for multi-timeframe analysis (1m → 5m → 1h on the fly).
|
|
256
|
-
- A **Binance Spot WebSocket** kline
|
|
294
|
+
- A streaming OHLCV **CSV reader** (`CandleReader`).
|
|
295
|
+
- A **tick-to-candle aggregator** with arbitrary timeframes (`TickAggregator`).
|
|
296
|
+
- A **candle resampler** for multi-timeframe analysis (1m → 5m → 1h on the fly, `Resampler`).
|
|
297
|
+
- A live **Binance Spot WebSocket** kline feed (`BinanceFeed`, feature `live-binance`).
|
|
298
|
+
- A historical **Binance REST** kline fetcher (`fetch_binance_klines`) — native
|
|
299
|
+
HTTP + JSON, no third-party client.
|
|
257
300
|
|
|
258
301
|
```rust
|
|
259
302
|
use wickra::{Indicator, Rsi};
|
|
@@ -270,8 +313,9 @@ while let Some(event) = stream.next_event().await? {
|
|
|
270
313
|
}
|
|
271
314
|
```
|
|
272
315
|
|
|
273
|
-
|
|
274
|
-
`
|
|
316
|
+
Native live-feed and historical-fetch examples — using `wickra.BinanceFeed` and
|
|
317
|
+
`wickra.fetch_binance_klines`, **with no third-party HTTP/WebSocket client** — live
|
|
318
|
+
under `examples/python/` (and the matching directory for every other language).
|
|
275
319
|
|
|
276
320
|
## Project layout
|
|
277
321
|
|
|
@@ -294,8 +338,8 @@ wickra/
|
|
|
294
338
|
├── examples/ examples/README.md indexes every language
|
|
295
339
|
│ ├── data/ real BTCUSDT OHLCV datasets, one per timeframe
|
|
296
340
|
│ ├── rust/ Rust workspace member (`wickra-examples`)
|
|
297
|
-
│ ├── python/ backtest, live
|
|
298
|
-
│ ├── node/ streaming, backtest, live
|
|
341
|
+
│ ├── python/ backtest, live Binance feed, parallel assets, multi-tf
|
|
342
|
+
│ ├── node/ streaming, backtest, live Binance feed (load `wickra`)
|
|
299
343
|
│ ├── wasm/ browser demo for `wickra-wasm`
|
|
300
344
|
│ ├── c/ C smoke + streaming, C++ RAII wrapper
|
|
301
345
|
│ ├── csharp/ streaming, backtest, strategies (load `Wickra`)
|
|
@@ -381,11 +425,15 @@ Every layer is covered; run the suites with the commands in
|
|
|
381
425
|
- `bindings/java`: JUnit cases covering one indicator per FFI archetype
|
|
382
426
|
(scalar/batch, multi-output, bars, profile, array input) plus batch equivalence.
|
|
383
427
|
|
|
384
|
-
|
|
385
|
-
language-neutral golden fixture
|
|
386
|
-
`
|
|
387
|
-
|
|
388
|
-
|
|
428
|
+
On top of those per-binding tests, **all 10 languages** (Rust, Python, Node.js,
|
|
429
|
+
WASM, C, C++, C#, Go, Java, R) replay a shared, language-neutral golden fixture
|
|
430
|
+
(`testdata/golden/*.csv`, generated by
|
|
431
|
+
`cargo run -p wickra-examples --bin gen_golden`) and assert **bit-for-bit parity
|
|
432
|
+
with the Rust reference for every one of the 514 indicators** across every
|
|
433
|
+
archetype (scalar, multi-output, pairwise, derivatives-tick, cross-section,
|
|
434
|
+
order-book, trade, profile, alt-chart bars, footprint). This catches FFI wiring
|
|
435
|
+
bugs the math-only core tests cannot see — it has already found and fixed real
|
|
436
|
+
cross-language marshalling bugs in the Java and R bindings.
|
|
389
437
|
|
|
390
438
|
## Contributing
|
|
391
439
|
|
package/package.json
CHANGED