CI codecov r-universe License: MIT OR Apache-2.0

Wickra Shazam — R


▶ Live demo: all 514 indicators over real Binance market data, computed live in your browser — live.wickra.org · zero backend, powered by wickra-wasm.

Point at live data → "that's the May-2021 crash setup". Match the current microstructure fingerprint of an asset against its entire history — for R. install.packages("wickrashazam", repos = "https://wickra-lib.r-universe.dev") — over the C ABI via .Call, prebuilt library fetched on install.

R bindings for the wickra-shazam data-driven core, over its C ABI hub (.Call). Build a shazam from a spec JSON, index an asset's history, match the current fingerprint against it — the same protocol as the CLI and every other binding.

Install

From r-universe:

install.packages("wickrashazam", repos = "https://wickra-lib.r-universe.dev")

The package's configure downloads the prebuilt C ABI library for this exact version from the GitHub release and bundles it, so an ordinary install needs nothing but a C toolchain (Rtools on Windows) for the thin .Call glue layer. To build against a local checkout instead, point it at the header and library with the environment variables below.

Building from this repository (contributors)

The package links the wickra_shazam C ABI, located out-of-tree via two environment variables:

# Build the C ABI shared library first.
cargo build -p wickra-shazam-c --release

export WKSHZM_INC="$PWD/bindings/c/include"
export WKSHZM_LIB="$PWD/target/release"
# The loader must also find the shared library at run time:
export LD_LIBRARY_PATH="$WKSHZM_LIB:$LD_LIBRARY_PATH"   # PATH on Windows

R CMD INSTALL bindings/r
Rscript bindings/r/tests/run_tests.R

Quick start

library(wickrashazam)

spec <- paste0(
  '{"features":[{"kind":"price","field":"close"}],',
  '"window":1,"metric":"euclid"}'
)

shazam <- wkshzm_new(spec)

candle <- function(time, close) {
  paste0(
    '{"time":', time, ',"open":', close, ',"high":', close,
    ',"low":', close, ',"close":', close, ',"volume":1}'
  )
}

# Index the asset's history.
history <- paste0("[", paste(
  vapply(1:10, function(i) candle(i, 100 + i), character(1)), collapse = ","
), "]")
wkshzm_command(shazam, paste0('{"cmd":"index","history":', history, '}'))

# Match the current state against the history.
raw <- wkshzm_command(
  shazam, paste0('{"cmd":"match","current":[', candle(11, 110), '],"k":3}')
)
cat(raw, "\n")
cat(wkshzm_version(), "\n")

API

Function Description
wkshzm_new(spec_json) Build a shazam from a spec JSON (errors on an invalid spec).
wkshzm_command(shazam, cmd_json) Apply a command JSON, return the response JSON.
wkshzm_version() The library version.

Benchmark

Every binding forwards to the same data-driven Rust core, so what this one adds is the call overhead of R's native .Call interface over the C ABI, not a different result. The core's throughput is measured by the repository's benchmark suite and the nightly bench.yml run; the numbers, the machine and how to reproduce them are in the repository BENCHMARKS.md.

Documentation

The full guide, the spec reference and the API documentation live in the main repository and the documentation site:

Wickra Shazam ships native bindings for Python, Node.js, WASM and Rust, plus a C ABI hub that any C-capable language (C, C++, C#, Go, Java, R) links against — all forwarding to the same data-driven, unsafe-forbidden Rust core.

Security

Found a security issue? Please don't open a public issue. Report it privately via the repository's Security tab ("Report a vulnerability") or email support@wickra.org with a subject line starting [wickra security]. Full policy: https://github.com/wickra-lib/wickra-shazam/blob/main/SECURITY.md.

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.

License

Licensed under either of Apache-2.0 or MIT at your option.