examples(node): add a fetch_btcusdt script using built-in fetch
Node had no sibling for the Rust and Python `fetch_btcusdt` data-generators — adding it closes the "fetch (data-gen)" cell for the last remaining row of the cross-language example matrix where the pattern makes sense. * examples/node/fetch_btcusdt.js — uses Node 18+'s built-in global `fetch` (no npm dependencies); same pagination logic as the Rust and Python siblings (paginate backwards via `endTime`, drop the in-progress bucket, sort and trim to the configured target). Applies the same OHLC validity check the Rust `Candle::new` constructor enforces so a malformed kline is skipped rather than written. * JavaScript's `String(v)` already gives the shortest round-trip representation and strips the `.0` suffix for whole-number floats, so the CSV output is byte-for-byte identical to what the Rust and Python fetchers produce on the same Binance snapshot. Verified by running it and `git diff`-ing against the checked-in dataset: every row older than the run is unchanged; only the most recent ~24 hours drift because the market kept moving. examples/README.md gains the new row.
This commit is contained in:
@@ -47,6 +47,7 @@ cd ../../examples/node && npm install # links wickra + installs `ws`
|
||||
| `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` |
|
||||
| `fetch_btcusdt.js` | Download real BTCUSDT klines from the Binance REST API into `examples/data/` (built-in `fetch`, Node 18+). | `node fetch_btcusdt.js` |
|
||||
|
||||
## WebAssembly — `examples/wasm/`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user