Continue the per-language `examples/<lang>/` restructure: move the three
Node example files (streaming.js, backtest.js, live_trading.js) out of
bindings/node/examples/ and into a top-level examples/node/ directory.
* `examples/node/package.json` is a `private` package that pulls the
native binding via `file:../../bindings/node` and lists `ws` as a
dev-dependency for the live-trading example. `require('..')` in each
file becomes `require('wickra')` — exactly what a downstream user would
write — and the file-header run instructions are updated to the new
two-step workflow (`npm install` in bindings/node, then in
examples/node).
* `backtest.js`'s default-CSV path becomes the much shorter
`__dirname/../data/btcusdt-1d.csv` from the new location.
* `bindings/node/package.json` drops the now-unused `ws` devDependency.
* `.gitignore` is broadened from `bindings/node/node_modules/` to
`**/node_modules/` so the new `examples/node/node_modules/` directory is
not tracked.
* The README "Languages" table, project-layout block and
`examples/README.md` Node section are updated for the new paths and run
commands.
Verified by running `node backtest.js` (3200 BTCUSDT daily bars, matching
output), `node streaming.js`, and `node --check live_trading.js` from the
new location.
Wickra examples
Runnable examples for every Wickra binding. Rust and Node examples live next
to the code they exercise so the language tooling (cargo run --example,
node) can find them; the Python examples have no crate of their own and
live here under python/.
Rust — examples/rust/
The Rust examples live in the wickra-examples workspace member crate.
| Example | What it does | Run |
|---|---|---|
backtest.rs |
Compute a basket of indicators over an OHLCV CSV and print a summary. | cargo run -p wickra-examples --bin backtest -- <ohlcv.csv> |
fetch_btcusdt.rs |
Download real BTCUSDT klines from the Binance REST API into examples/data/. |
cargo run -p wickra-examples --bin fetch_btcusdt |
live_binance.rs |
Stream live Binance klines through an indicator over a resilient WebSocket. | cargo run -p wickra-examples --bin live_binance |
Python — examples/python/
| Example | What it does | Run |
|---|---|---|
backtest.py |
Basket of indicators over an OHLCV CSV. | python -m examples.python.backtest <ohlcv.csv> |
live_trading.py |
Live Binance feed → RSI / MACD / Bollinger → signals. | python -m examples.python.live_trading --symbol BTCUSDT --interval 1m |
multi_timeframe.py |
Resample a 1-minute CSV to coarser timeframes and compare. | python -m examples.python.multi_timeframe <1m.csv> |
parallel_assets.py |
Process many symbols in parallel — the Rust extension releases the GIL during batch computation. | python -m examples.python.parallel_assets --assets 200 --bars 5000 |
live_trading.py additionally needs pip install websockets.
Node.js — examples/node/
Build the native binding once, then link it into the examples directory:
cd bindings/node && npm install && npx napi build --platform --release
cd ../../examples/node && npm install # links wickra + installs `ws`
| Example | What it does | Run |
|---|---|---|
streaming.js |
Feed a synthetic price series through several indicators tick by tick. | node streaming.js |
backtest.js |
Basket of indicators over an OHLCV CSV; defaults to the bundled BTCUSDT daily dataset. | node backtest.js [ohlcv.csv] |
live_trading.js |
Live Binance feed → RSI / MACD / Bollinger → signals. | node live_trading.js --symbol BTCUSDT --interval 1m |
WebAssembly — bindings/wasm/examples/
| Example | What it does | Run |
|---|---|---|
index.html |
Browser demo: streams a price series through six indicators and draws a live <canvas> chart. |
wasm-pack build bindings/wasm --target web --release --features panic-hook, then serve bindings/wasm/ and open examples/index.html |
Example datasets
examples/data/ holds seven real BTCUSDT OHLCV datasets, one
per timeframe (1m, 5m, 15m, 1h, 12h, 1d, 1month), in the standard
timestamp,open,high,low,close,volume layout. The Rust and Node backtest
examples and the indicator benchmarks run against them. Regenerate them with
the latest market history via cargo run -p wickra-examples --bin fetch_btcusdt.