examples: move the WASM browser demo into a top-level examples/wasm/
Finish the per-language `examples/<lang>/` restructure by relocating the WASM browser demo from bindings/wasm/examples/ to examples/wasm/. * `examples/wasm/index.html` is the moved file; its WASM module import becomes `../../bindings/wasm/pkg/wickra_wasm.js` so the demo still loads the wasm-pack output without copying it. * bindings/wasm/README.md, Quickstart-WASM.md, examples/README.md and the root README "Languages" + project-layout block all point at the new path. The serve command in the docs now says "serve the repository root and open examples/wasm/index.html". `bindings/wasm/examples/` is empty after the move; the now-empty directory is removed.
This commit is contained in:
@@ -119,7 +119,7 @@ inherit it automatically.
|
||||
|-------------------|-----------------------------------------------|---------|
|
||||
| Python (PyO3) | `pip install wickra` | `examples/python/backtest.py` |
|
||||
| Node.js (napi-rs) | `npm install wickra` | `examples/node/backtest.js` |
|
||||
| Browser / WASM | `npm install wickra-wasm` | `bindings/wasm/examples/index.html` |
|
||||
| Browser / WASM | `npm install wickra-wasm` | `examples/wasm/index.html` |
|
||||
| Rust | `cargo add wickra` | `examples/rust/src/bin/backtest.rs` |
|
||||
|
||||
Each binding ships several runnable examples (streaming, backtest, live feed);
|
||||
@@ -187,12 +187,13 @@ wickra/
|
||||
├── bindings/
|
||||
│ ├── python/ PyO3 + maturin (publishes on PyPI)
|
||||
│ ├── node/ napi-rs (publishes on npm)
|
||||
│ └── wasm/ wasm-bindgen (browsers, bundlers, Node) + examples/
|
||||
│ └── wasm/ wasm-bindgen (browsers, bundlers, Node)
|
||||
├── examples/ examples/README.md indexes every language
|
||||
│ ├── data/ real BTCUSDT OHLCV datasets, one per timeframe
|
||||
│ ├── rust/ Rust workspace member (`wickra-examples`)
|
||||
│ ├── python/ backtest, live trading, parallel assets, multi-tf
|
||||
│ └── node/ streaming, backtest, live trading (load `wickra`)
|
||||
│ ├── node/ streaming, backtest, live trading (load `wickra`)
|
||||
│ └── wasm/ browser demo for `wickra-wasm`
|
||||
└── .github/workflows/ CI and release pipelines
|
||||
```
|
||||
|
||||
|
||||
@@ -43,5 +43,7 @@ for (const price of livePrices) {
|
||||
const sma = new SMA(20).batch(new Float64Array(historicalPrices));
|
||||
```
|
||||
|
||||
An interactive demo lives in `bindings/wasm/examples/index.html`. After building
|
||||
the package serve the `bindings/wasm/` directory and open `examples/index.html`.
|
||||
An interactive demo lives in [`examples/wasm/index.html`](../../examples/wasm/index.html)
|
||||
(top-level alongside the other language examples). After building the package
|
||||
with `wasm-pack build`, serve the repository root and open
|
||||
`examples/wasm/index.html` in a browser.
|
||||
|
||||
@@ -114,13 +114,13 @@ try {
|
||||
|
||||
## A complete example
|
||||
|
||||
`bindings/wasm/examples/index.html` is a self-contained browser demo: it
|
||||
streams a synthetic price series through six indicators and draws a live
|
||||
chart on a `<canvas>`. Open it after a `--target web` build:
|
||||
`examples/wasm/index.html` is a self-contained browser demo: it streams a
|
||||
synthetic price series through six indicators and draws a live chart on a
|
||||
`<canvas>`. Open it after a `--target web` build:
|
||||
|
||||
```bash
|
||||
wasm-pack build bindings/wasm --target web --release --features panic-hook
|
||||
# then serve the bindings/wasm directory and open examples/index.html
|
||||
# then serve the repository root and open examples/wasm/index.html
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
+2
-2
@@ -41,11 +41,11 @@ cd ../../examples/node && npm install # links wickra + installs `ws`
|
||||
| `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/`
|
||||
## WebAssembly — `examples/wasm/`
|
||||
|
||||
| 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` |
|
||||
| `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 the repository root and open `examples/wasm/index.html` |
|
||||
|
||||
## Example datasets
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
import init, {
|
||||
version, installPanicHook,
|
||||
SMA, EMA, RSI, MACD, BollingerBands, ATR,
|
||||
} from "../pkg/wickra_wasm.js";
|
||||
} from "../../bindings/wasm/pkg/wickra_wasm.js";
|
||||
|
||||
const canvas = document.getElementById("chart");
|
||||
const ctx = canvas.getContext("2d");
|
||||
Reference in New Issue
Block a user