Wickra Shazam
Point at live data → "that's the May-2021 crash setup". Match the current microstructure fingerprint of an asset against its entire history.
▶ Live demo: all 514 indicators over real Binance market data, computed live in your browser — live.wickra.org · zero backend, powered by
wickra-wasm.
Part of the Wickra ecosystem: the same data-driven core and ten-language binding surface also power wickra-exchange, wickra-backtest, wickra-terminal and 20 more — see the full list.
Wickra Shazam turns an asset's whole history into a rolling index of fixed-dimension microstructure fingerprints — a vector built from the full Wickra feature space (indicators, price, and microstructure: order-book imbalance, funding, open interest, liquidations, footprint) — and matches the current fingerprint against that entire index to name the regime. It is pattern/regime recognition over the full feature space, not price alone.
- The fingerprint is data — a serde
FingerprintSpec(an ordered feature list +window+normalize+metric), not Rust closures, so it crosses the C ABI and WASM unchanged. A fixed dimensionNis what makes it deterministic. - Deterministic core — indexing and matching are byte-identical across all ten languages and between the parallel (rayon) and sequential (WASM) builds.
- Three operations, one core —
index(history, spec)builds the rolling index,match_current(index, current, k)finds thekmost similar historical fingerprints, and a label attaches a human name ("may_2021_crash") to a match.
The core is one library (wickra-shazam-core), usable from
Rust, Python, Node.js, WASM, C, C++, C#, Go, Java and R over a
JSON-over-C-ABI boundary, plus a reference CLI.
# Index a history and match the current state, human-readable table:
cargo run -p wickra-shazam -- --spec golden/specs/crash_setup.json \
--history golden/data/history/sym-01.csv --current golden/data/current/sym-01.csv
# Raw MatchReport JSON (the same bytes every binding returns), top 5 matches:
cargo run -p wickra-shazam -- --spec golden/specs/price_euclid.json \
--history golden/data/history/sym-01.csv --k 5 --format json
Status
Early development (0.1.0). The core, the CLI, all ten language bindings, the byte-exact golden corpus, property + fuzz tests, benchmarks and one runnable example per language are in place and green across the full CI matrix (10 languages × 3 OS); 0.1.0 is the first published release. What comes next is in ROADMAP.md.
Documentation
- Architecture — the core, the data-driven boundary, the binding surface.
- Guides under
docs/: Fingerprints & FingerprintSpec · Features · Similarity & metrics · Labels · Cookbook · Internals. - ROADMAP.md · BENCHMARKS.md · THREAT_MODEL.md · SECURITY.md.
Quickstart
# Index a history and match the current state, human-readable table:
cargo run -p wickra-shazam -- --spec golden/specs/crash_setup.json \
--history golden/data/history/sym-01.csv --current golden/data/current/sym-01.csv
# Raw MatchReport JSON (the same bytes every binding returns), top 5 matches:
cargo run -p wickra-shazam -- --spec golden/specs/price_euclid.json \
--history golden/data/history/sym-01.csv --k 5 --format json
--current defaults to the last window bars of --history. Attach a label to
a historical bar with --label <ts>=<name> (repeatable) and it comes back on any
match at that timestamp.
FingerprintSpec / features
A spec is a JSON (or TOML) document: an ordered features list, a window, a
normalize mode and a metric. The feature order is the vector's axis order
and never changes within an index, so the dimension N = features.len() * window
is fixed and the fingerprint is fully deterministic.
{
"features": [
{ "kind": "indicator", "name": "Rsi", "params": [14] },
{ "kind": "indicator", "name": "Sma", "params": [20] },
{ "kind": "indicator", "name": "Atr", "params": [14] },
{ "kind": "price", "field": "close" },
{ "kind": "price", "field": "volume" }
],
"window": 1,
"normalize": "z_score",
"metric": "cosine"
}
indicator— any PascalCase Wickra indicator resolved from the registry byname+params(Rsi,Sma,Atr,Macd, …), with an optionalfieldto pick a sub-output of a multi-output indicator.price— a raw OHLCV field (open/high/low/close/volume).microstructure— an order-book / flow feature (imbalance, funding, open interest, liquidations, footprint), resolved from the same registry.window— how many consecutive bars are stacked into one fingerprint (1= the current bar only;> 1= a short shape).
Similarity & metrics
The metric decides how two fingerprints are compared. Similarity is always
mapped to [0, 1] (1 = identical) and rounded deterministically:
cosine— cosine of the angle between the flat vectors, mapped from[-1, 1]to[0, 1]via(cos + 1) / 2. Scale-insensitive; good withz_scorenormalization.euclid—1 / (1 + d)wheredis the L2 distance. Scale-sensitive; pair withmin_maxorz_scoreto weight features evenly.dtw— dynamic time warping over the per-bar feature vectors of awindow > 1spec, tolerant of small time shifts between two shapes. Withwindow == 1it is identical toeuclid.
normalize (none · z_score · min_max) is fitted once over the whole index
and reused for the current fingerprint, so history and query live on the same
axes.
Labels
A label attaches a human-readable name to a historical timestamp; when a match lands on that bar the name rides along in the report:
{ "cmd": "label", "ts": 1700216000, "label": "may_2021_crash" }
// → a later match at ts 1700216000 comes back as
// { "ts": 1700216000, "similarity": 0.98, "label": "may_2021_crash" }
Use in any language
The same Shazam handle — construct from a JSON spec, drive with
command(json) -> json, read version — is reachable from every binding. The
commands are set_spec, index, match, label, reset and version;
index returns {"indexed":N} and match returns a MatchReport that is
byte-identical to the CLI's --format json.
from wickra_shazam import Shazam
s = Shazam('{"features":[{"kind":"price","field":"close"}],'
'"window":1,"metric":"euclid"}')
s.command('{"cmd":"index","history":[/* candles */]}')
report = s.command('{"cmd":"match","current":[/* candles */],"k":5}') # JSON MatchReport
The C ABI hub (bindings/c) backs C, C++, C#, Go, Java and R;
Rust, Python, Node.js and WASM are native. See each bindings/<lang>/README.md
and the runnable examples/.
Project layout
crates/shazam-core the deterministic core (FingerprintSpec, index, match_current, labels)
crates/shazam-cli the CLI (bin: wickra-shazam)
crates/shazam-bench criterion benchmarks
bindings/{python,node,wasm,c,go,csharp,java,r} the ten-language surface
golden/ CSV histories, current windows, specs, and byte-exact expected reports
fuzz/ cargo-fuzz targets (spec_parse, build_index, match_index, normalize_metric)
examples/ one runnable "index a history and match the current state" example per language
Building everything from source
cargo build --workspace
cargo test --workspace --all-features
cargo test --workspace --no-default-features # sequential (WASM) index/match path
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo run -p wickra-shazam -- --spec golden/specs/crash_setup.json \
--history golden/data/history/sym-01.csv
Each binding builds from its own directory — see the per-binding READMEs under
bindings/.
Testing
Run the suites with the commands in Building everything from source.
wickra-shazam-core— unit tests per feature axis, normalisation and metric, the index and search path, the parallel-versus-sequential parity, property tests over histories and the command envelope, and the operating-mode check (a label sent beforeindexand one sent after yield the samematchreport; re-indexing keeps it). The golden fixtures ingolden/are the anchor: the same(spec, history, current)triple must match to the same report bytes here as in every binding.- Every binding asserts the same golden bytes and the same operating-mode
equivalence. That is the whole cross-language claim, so it is checked the
same way in each one rather than approximated per language: Python with
pytest (and a plain runner on 3.9), Node with
node --test, WASM through the nodejs build, C and C++ throughctest, C# withdotnet test, Go withgo test, Java with JUnit, and R with the shippedtests/smoke.Rplus the repository'srun_tests.R. - Examples — every example under
examples/runs in CI and is held to the version and the matches it prints. - Fuzz —
fuzz/holds libFuzzer targets over spec parsing, metric normalisation, the index build and the match; CI runs each for a short smoke.
Requirements
- Rust 1.86+ — the workspace MSRV; the Node binding needs Rust 1.88.
- Python 3.9+ — the Python binding.
- Node 22+ — the Node binding.
- Go 1.23+ — the Go binding.
- Java 22+ — the Java binding.
- R 4.1+ — the R package.
- .NET 8+ — the C# binding.
- A C11 / C++17 compiler with CMake 3.15+ for the C and C++ examples.
See each bindings/<lang>/README.md for the per-language build and install.
Benchmarks
crates/shazam-bench measures build_index scaling by history length and
feature count, and match_index by index size and metric (cosine / euclid /
dtw), parallel vs sequential. See BENCHMARKS.md.
Ecosystem
Part of the Wickra family — each one a data-driven core with a CLI and the same ten-language binding surface:
- wickra — main library (Rust core + Python / Node.js / WASM bindings + a C ABI for C / C++ / C# / Go / Java / R)
- wickra-playground — a polyglot strategy playground: one StrategySpec live side by side in Python, Rust, JS and Go, entirely in the browser
- wickra-exchange — unified market-data + execution across ten crypto exchanges
- wickra-backtest — event-driven backtester over the Wickra core
- wickra-terminal — the trading terminal: a TUI and a browser renderer over the stack
- wickra-screener — parallel multi-symbol screening over 514 streaming indicators
- wickra-xray — market-microstructure explorer: footprint, order-book heatmap, liquidation map, funding/OI divergence
- wickra-radar — perp-universe alert radar: OI delta, funding flip, book imbalance, liquidation clusters, OI/price divergence
- wickra-copilot — local market copilot grounded in real order-book, liquidation and funding microstructure
- wickra-benchmark — reproducible, golden-verified benchmark suite — recompute any (strategy, dataset, report) in ten languages and confirm it byte-for-byte
- wickra-strategy-ci — Jest for trading strategies: golden-pin the report, catch regressions in CI, property-test against fuzzed data
- wickra-verify — confirm or refute a claimed backtest report against its strategy and data, in ten languages
- wickra-proof — Proof-of-Backtest: deterministic (spec, data) → report + blake3 hash, recomputable byte-for-byte in ten languages
- wickra-zk — prove a backtest zero-knowledge — on-chain-verifiable performance without revealing the data or the strategy
- wickra-impact — the backtester that knows you would have moved the market: agent-based fills on the real historical L2 order book
- wickra-darwin — evolutionary strategy search at millions of backtests per second, mutating and crossing JSON specs across the 514-indicator space
- wickra-gym — a Gymnasium-compatible, microstructure-aware backtest environment with O(1) steps for deterministic RL rollouts
- wickra-feature-store — OHLCV and microstructure streams into ML-ready feature matrices over 514 O(1) streaming indicators
- wickra-genome — a vector database of the whole market: every asset a 514-dim live vector, for similarity search, clustering and anomaly detection
- wickra-timemachine — scrub the whole market like a video — every symbol, full order book, rewound to any moment via deterministic re-fold
- wickra-synth — deterministic synthetic market microstructure: OHLCV, order book, trades and funding from a single seed
- wickra-compile — compile a strategy spec into a standalone deployable: a WASM module, a self-contained binary, or a
no_stdartifact - wickra-embed — allocation-free,
no_stdstreaming indicators for bare-metal and HFT, byte-for-byte identical to the core - wickra-pico — the O(1) indicator core running bare-metal on a $5 Raspberry Pi Pico — the LED blinks on the EMA cross
Docs at docs.wickra.org; the marketing site and in-browser demo at wickra.org.
Contributing
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Commits are signed and in English; open a PR against main.
Security
See SECURITY.md and THREAT_MODEL.md. Report vulnerabilities privately — never in a public issue.
License
Dual-licensed under either MIT or Apache-2.0, at your option.
Disclaimer
Wickra Shazam is analysis software: it computes similarity between market states. A historical match is a statistical resemblance, not a prediction and not financial advice — the past setup did not have to repeat, and neither does this one. It places no orders. Trading carries risk of loss; review the code and use at your own discretion.
Built on Wickra. If it saved you time, the cheapest way to say thanks is to ⭐ the repo.
Release files for wickra-shazam 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wickra_shazam-0.1.0.tar.gz | 82.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wickra_shazam-0.1.0-cp39-abi3-win_arm64.whl | CPython 3.9 | abi3 | Windows ARM64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ ARM64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| wickra_shazam-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 5.7 MB
Release files / wickra_shazam-0.1.0.tar.gz
| Download URL | wickra_shazam-0.1.0.tar.gz |
|---|---|
| Size | 82.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc8e32924ed4711df1a3ba227815dacd076bf220214b02ed29237c8da7cbc796
|
|
BLAKE2b-256 checksum How to use checksums |
0160c739cbf8dc71093ed6ba42d1c6641bc118d41c7f4b7fde4bfd6b401426cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-win_arm64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-win_arm64.whl |
|---|---|
| Size | 526.2 kB |
| Tags | CPython 3.9 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
99ed24b877d37e24ea5f914704a72c980ac76d8e85cc8ce41e8f8c9a5f200065
|
|
BLAKE2b-256 checksum How to use checksums |
f2eb870e8e96c3a745ef95780e99e41f2831259c892f5bf5789330b88ffe237a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-win_amd64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 602.6 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f9f297ff30d4c902e89c0a07a76202258815a38100f1b6911df81970c156474a
|
|
BLAKE2b-256 checksum How to use checksums |
9fe0f75267af40dc075e7a96814cbc7b15f9700256e9cc95431ca2f9f49fd16b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 950.0 kB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6bdcd9c75d1b98089b5a267025e920edeadf9c8aba19c0dc7f4ad11a29974a9c
|
|
BLAKE2b-256 checksum How to use checksums |
ab4729e3b039a24c641933a0486319bc455f2798a22970430524294a3dc7ece5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 836.4 kB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
996eafdbf988e4f49e921f53ca5fe8144f6d7ecfa645a2984a5c947165a1a6ad
|
|
BLAKE2b-256 checksum How to use checksums |
8b80608ab01981fa2570d64828d6be2af4c854cd7961702df001d68ebbddfa8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 733.2 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
461a5feb349ce634bc7c55ae0d09174ca5fd8b0784973e121c41474ed36383f6
|
|
BLAKE2b-256 checksum How to use checksums |
f38b7df502b3d3c2dcbce716ccad9b477438cfb1331b65b3a1299414e8257f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 657.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
616bf6a62d36bc2e4ccf804ac7bdce8c35d949e9b37aa62b0e61bfa85bca1fa0
|
|
BLAKE2b-256 checksum How to use checksums |
6684ea5ddf25ffdf22c08f8beba5ac9979863e8b8fb2609da77b71509d19f002
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 594.0 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3bea17a293d355292e71e5ec4989dc534f0137f73526164c9c4e35fce5bc1d23
|
|
BLAKE2b-256 checksum How to use checksums |
a8a3a8cf543f34fd3239a7b322d236118cc6b385e28f5f41326e4ed334754e6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / wickra_shazam-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | wickra_shazam-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 688.5 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1e4e0422d6c4563a44dda1e9eb59fa97e0a2c4110b5bc5f5f0e998d4186b5fd7
|
|
BLAKE2b-256 checksum How to use checksums |
41a953cd79e570beb85475e84ce3c385bc9c00337e89c5e0be5bce689242c25f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|