From de1112ea9117cc4c54b4a1723d94137aa0079b96 Mon Sep 17 00:00:00 2001 From: kingchenc Date: Mon, 15 Jun 2026 03:41:19 +0200 Subject: [PATCH] chore(examples): rename live_trading examples to live_binance (#301) The examples stream a live Binance feed into the indicators and print signals; they place no orders, so 'live_trading' overstated them and was inconsistent with the C/Go/R examples already named live_binance. Rename the Python/Node/WASM files to live_binance.* and update every reference, run command, header, and the project-tree listings. Accurate use-case wording ('suitable for live trading bots') and the risk disclaimers are left unchanged. --- ARCHITECTURE.md | 2 +- README.md | 8 ++++---- examples/README.md | 8 ++++---- examples/c/live_binance.c | 2 +- examples/node/{live_trading.js => live_binance.js} | 6 +++--- examples/python/{live_trading.py => live_binance.py} | 4 ++-- examples/wasm/README.md | 2 +- examples/wasm/{live_trading.html => live_binance.html} | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) rename examples/node/{live_trading.js => live_binance.js} (97%) rename examples/python/{live_trading.py => live_binance.py} (97%) rename examples/wasm/{live_trading.html => live_binance.html} (97%) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 5a2bfa9e..6dc708b0 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -227,7 +227,7 @@ A handful of indicators need care beyond naive accumulation: A typical full-stack call sequence for a Python live-trading example: ``` -[ Python: live_trading.py ] +[ Python: live_binance.py ] │ ▼ [ binance.AsyncClient WebSocket ] ──── wickra_data live feed ───┐ diff --git a/README.md b/README.md index a9cd9d16..fb539524 100644 --- a/README.md +++ b/README.md @@ -270,8 +270,8 @@ while let Some(event) = stream.next_event().await? { } ``` -A Python live-trading example using the public `websockets` package lives at -`examples/python/live_trading.py`. +A Python live Binance feed example using the public `websockets` package lives at +`examples/python/live_binance.py`. ## Project layout @@ -294,8 +294,8 @@ wickra/ ├── 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`) +│ ├── python/ backtest, live Binance feed, parallel assets, multi-tf +│ ├── node/ streaming, backtest, live Binance feed (load `wickra`) │ ├── wasm/ browser demo for `wickra-wasm` │ ├── c/ C smoke + streaming, C++ RAII wrapper │ ├── csharp/ streaming, backtest, strategies (load `Wickra`) diff --git a/examples/README.md b/examples/README.md index 8f265b0e..68c5c8a7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -142,7 +142,7 @@ build-checked but not run in CI. | --- | --- | --- | | `streaming.py` | Feed a synthetic price series through SMA / EMA / RSI / MACD tick by tick. | `python -m examples.python.streaming` | | `backtest.py` | Basket of indicators over an OHLCV CSV. | `python -m examples.python.backtest ` | -| `live_trading.py` | Live Binance feed → RSI / MACD / Bollinger → signals. | `python -m examples.python.live_trading --symbol BTCUSDT --interval 1m` | +| `live_binance.py` | Live Binance feed → RSI / MACD / Bollinger → signals. | `python -m examples.python.live_binance --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` | | `fetch_btcusdt.py` | Download real BTCUSDT klines from the Binance REST API into `examples/data/` (urllib + stdlib only). | `python -m examples.python.fetch_btcusdt` | @@ -150,7 +150,7 @@ build-checked but not run in CI. | `strategy_macd_adx.py` | Hourly BTCUSDT trend-follower: MACD crossover entries gated by ADX(14) > 20. | `python -m examples.python.strategy_macd_adx` | | `strategy_bollinger_squeeze.py` | Daily BTCUSDT Bollinger-squeeze breakout with ATR(14) trailing stop. | `python -m examples.python.strategy_bollinger_squeeze` | -`live_trading.py` additionally needs `pip install websockets`. +`live_binance.py` additionally needs `pip install websockets`. ## Node.js — `examples/node/` @@ -167,7 +167,7 @@ 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]` | | `multi_timeframe.js` | Roll a 1-minute CSV up to 5m / 15m / 1h / 4h / 1d and print indicators per timeframe. | `node multi_timeframe.js [path/to/1m.csv]` | | `parallel_assets.js` | Serial vs `worker_threads` pool over a synthetic panel, with speedup. | `node parallel_assets.js --assets 200 --bars 5000` | -| `live_trading.js` | Live Binance feed → RSI / MACD / Bollinger → signals. | `node live_trading.js --symbol BTCUSDT --interval 1m` | +| `live_binance.js` | Live Binance feed → RSI / MACD / Bollinger → signals. | `node live_binance.js --symbol BTCUSDT --interval 1m` | | `fetch_btcusdt.js` | Download real BTCUSDT klines from the Binance REST API into `examples/data/` (built-in `fetch`, Node 18+). | `node fetch_btcusdt.js` | | `strategy_rsi_mean_reversion.js` | Hourly BTCUSDT mean-reversion using RSI(14) thresholds, with PnL / Sharpe / max-DD summary. | `node strategy_rsi_mean_reversion.js` | | `strategy_macd_adx.js` | Hourly BTCUSDT trend-follower: MACD crossover entries gated by ADX(14) > 20. | `node strategy_macd_adx.js` | @@ -188,7 +188,7 @@ Then serve the repository root (`python -m http.server`, `npx http-server`, | --- | --- | | `index.html` | Streams a synthetic price series through six indicators and draws a live `` chart. | | `backtest.html` | Streams a fetched OHLCV CSV through a basket of indicators (SMA, EMA, RSI, MACD, Bollinger, ATR, ADX, OBV) and prints a per-series summary table. | -| `live_trading.html` | Opens a browser-native `WebSocket` to Binance, runs RSI / MACD / Bollinger and flags BUY/SELL candidates. | +| `live_binance.html` | Opens a browser-native `WebSocket` to Binance, runs RSI / MACD / Bollinger and flags BUY/SELL candidates. | | `multi_timeframe.html` | Fetches a 1-minute CSV, rolls it up to 5m / 15m / 1h / 4h / 1d in-page, prints RSI / MACD hist / ADX per timeframe. | | `parallel_assets.html` | Spawns a pool of module Workers (each loading its own copy of the WASM module) and reports the speedup over a serial baseline. | | `strategy_rsi_mean_reversion.html` | Hourly BTCUSDT RSI(14) mean-reversion (long < 30, exit > 70); prints a PnL / Sharpe / max-DD summary table. | diff --git a/examples/c/live_binance.c b/examples/c/live_binance.c index daa06494..1ad64b53 100644 --- a/examples/c/live_binance.c +++ b/examples/c/live_binance.c @@ -1,7 +1,7 @@ /* Live BTCUSDT indicator with the Wickra C ABI. * * The C counterpart of `examples/rust/src/bin/live_binance.rs`, - * `examples/python/live_trading.py` and `examples/node/live_trading.js`. Those + * `examples/python/live_binance.py` and `examples/node/live_binance.js`. Those * stream Binance over a WebSocket; the C ABI ships only the indicators and no * socket layer, so this example polls the Binance REST klines endpoint via the * system `curl` once per interval and feeds each newly *closed* candle into a diff --git a/examples/node/live_trading.js b/examples/node/live_binance.js similarity index 97% rename from examples/node/live_trading.js rename to examples/node/live_binance.js index b24e26c5..5b0c8806 100644 --- a/examples/node/live_trading.js +++ b/examples/node/live_binance.js @@ -1,17 +1,17 @@ -// Live trading skeleton for the Wickra Node binding. +// Live Binance feed example for the Wickra Node binding. // // Connects to Binance's public WebSocket feed (no API key needed) and runs // RSI / MACD / Bollinger Bands on the incoming close prices. When RSI crosses // the common overbought / oversold thresholds *and* the MACD histogram // confirms the direction *and* price pierces the matching Bollinger band, a // signal line is printed. No orders are placed. It is the Node counterpart of -// examples/python/live_trading.py. +// examples/python/live_binance.py. // // Run it from the repository after building the native binding: // // cd bindings/node && npm install && npx napi build --platform --release // cd ../../examples/node && npm install # pulls `ws` for this example -// node live_trading.js --symbol BTCUSDT --interval 1m +// node live_binance.js --symbol BTCUSDT --interval 1m // // Stop it with Ctrl+C. diff --git a/examples/python/live_trading.py b/examples/python/live_binance.py similarity index 97% rename from examples/python/live_trading.py rename to examples/python/live_binance.py index 2c04d26d..433e9bbe 100644 --- a/examples/python/live_trading.py +++ b/examples/python/live_binance.py @@ -1,4 +1,4 @@ -"""Live trading skeleton: stream Binance kline ticks → incremental indicators → signals. +"""Live Binance feed: stream Binance kline ticks → incremental indicators → signals. This example connects to Binance's public WebSocket feed (no API key needed) and runs RSI / MACD / Bollinger Bands on the close prices coming in. When the @@ -7,7 +7,7 @@ confirms the direction, a `Signal` event is printed. No orders are placed. Run with:: - python -m examples.python.live_trading --symbol BTCUSDT --interval 1m + python -m examples.python.live_binance --symbol BTCUSDT --interval 1m Dependencies:: diff --git a/examples/wasm/README.md b/examples/wasm/README.md index 5ae5818a..71f7db79 100644 --- a/examples/wasm/README.md +++ b/examples/wasm/README.md @@ -38,7 +38,7 @@ Then open the demo you want at `http://localhost:8000/examples/wasm/`. | --- | --- | | `index.html` | The original showcase: streams a synthetic price series through six indicators and draws a live `` chart with `SMA`, `EMA`, `RSI`, `MACD`, `BollingerBands` and `ATR` cards. | | `backtest.html` | Backtest: fetches an OHLCV CSV (default the bundled BTCUSDT daily dataset), streams every candle through a basket of eight indicators, prints a summary table. Mirrors `examples/python/backtest.py`. | -| `live_trading.html` | Browser-native `WebSocket` to Binance kline streams; runs RSI / MACD / Bollinger on the incoming closes and flags BUY/SELL candidates when the three agree. Mirrors `examples/python/live_trading.py`. | +| `live_binance.html` | Browser-native `WebSocket` to Binance kline streams; runs RSI / MACD / Bollinger on the incoming closes and flags BUY/SELL candidates when the three agree. Mirrors `examples/python/live_binance.py`. | | `multi_timeframe.html` | Fetches a 1-minute CSV, rolls it up in-page to 5m / 15m / 1h / 4h / 1d buckets and prints RSI / MACD-histogram / ADX per timeframe. Mirrors `examples/python/multi_timeframe.py`. | | `parallel_assets.html` | Synthetic `(assets, bars)` panel, serial baseline on the main thread vs. a pool of module Workers each loading its own copy of the WASM module. Mirrors `examples/python/parallel_assets.py`. | | `parallel_worker.js` | Module worker used by `parallel_assets.html` (not loaded directly). | diff --git a/examples/wasm/live_trading.html b/examples/wasm/live_binance.html similarity index 97% rename from examples/wasm/live_trading.html rename to examples/wasm/live_binance.html index b656d1e6..3d53fa2a 100644 --- a/examples/wasm/live_trading.html +++ b/examples/wasm/live_binance.html @@ -2,7 +2,7 @@ - Wickra WASM — live trading + Wickra WASM — live Binance feed -

Wickra WASM — live trading

+

Wickra WASM — live Binance feed

Connects to Binance's public kline WebSocket from the browser, streams every tick through RSI(14), MACD(12,26,9) and Bollinger(20, 2.0) via the WebAssembly bindings, and flags BUY/SELL candidates when all three indicators agree. No orders are placed. Mirrors - examples/python/live_trading.py and - examples/node/live_trading.js. + examples/python/live_binance.py and + examples/node/live_binance.js.