677ea37402
Stacked on #315 (the native Binance REST fetcher). Retarget to `main` once #315 merges. Migrates the runnable examples off third-party data-I/O packages onto Wickra's native data layer (`CandleReader`, `Resampler`, `BinanceFeed`, `fetch_*klines`). ## Third-party packages removed (the zero-dep selling point) - **Node**: `ws` (live feed → BinanceFeed) — dropped from package.json + lockfile - **Go**: `github.com/coder/websocket` — dropped from go.mod / go.sum (`go mod tidy`) - **Java**: `jackson-databind` (live feed + REST fetch) — dropped from pom.xml - **R**: `jsonlite` + `websocket` + `later` — dropped from the README notes Each language's CSV loading now goes through `CandleReader`, manual resampling through `Resampler`, the live feed through `BinanceFeed`, and (Java/R) the REST download through the native fetcher. ## Verification Ran the offline examples per language against the bundled data — backtest and multi_timeframe produce identical output across Python / Node / Go / Java / R (e.g. ATR(14) last 345.1010; 1h→5m resamples to 240 bars, →15m to 80 bars). C# / C / WASM (stdlib-only, no third-party deps to remove) follow in this branch. Note: the streaming `strategy_*` examples have pre-existing candle-indicator runtime bugs (CI only syntax-smokes them); the CSV migration preserves their shape and leaves those bugs for a separate fix.
Wickra examples — Go
Runnable Go examples for the Wickra Go binding. Each example
is a small main program in its own directory; they share the deterministic
synthetic data, CSV loader, and equity summary in
internal/market.
The binding links against the prebuilt Wickra C ABI library, so build and stage it once before running anything:
cargo build -p wickra-c --release
cp target/release/libwickra.so bindings/go/lib/ # Linux
cp target/release/libwickra.dylib bindings/go/lib/ # macOS
cp target/release/wickra.dll bindings/go/lib/ # Windows (also put it on PATH)
Then run any example from the examples/go module:
cd examples/go
go run ./streaming
| Example | What it does | Run |
|---|---|---|
streaming |
Feed a synthetic price series through SMA / EMA / RSI / MACD tick by tick. | go run ./streaming |
backtest |
Compute a basket of indicators over an OHLCV series and print a summary. | go run ./backtest <ohlcv.csv> |
multi_timeframe |
Resample a 1-minute series into 5m / 15m and print an indicator per timeframe. | go run ./multi_timeframe |
parallel_assets |
SMA(20) batch over a panel of assets, serial vs goroutine fan-out, with speedup. | go run ./parallel_assets 200 5000 |
strategy_rsi_mean_reversion |
RSI(14) mean-reversion with a PnL / Sharpe / max-DD summary. | go run ./strategy_rsi_mean_reversion |
strategy_macd_adx |
MACD crossover entries gated by ADX(14) > 20. | go run ./strategy_macd_adx |
strategy_bollinger_squeeze |
Bollinger-squeeze breakout with an ATR(14) trailing stop. | go run ./strategy_bollinger_squeeze |
fetch_btcusdt |
Download real BTCUSDT klines from the Binance REST API into a CSV. | go run ./fetch_btcusdt |
live_binance |
Stream live Binance klines through EMA(20) over a WebSocket. | go run ./live_binance |
fetch_btcusdt and live_binance require network access; the rest run offline
on deterministic synthetic data.