examples: move Rust examples into a top-level examples/rust/ crate
The three Rust examples (backtest, fetch_btcusdt, live_binance) used to
live each in their own crate's examples/ dir, splitting the example set
across crates and burying it inside the source tree. Move them into a new
workspace member crate at `examples/rust/` (package `wickra-examples`,
`publish = false`) so all language examples sit under one top-level
`examples/<lang>/` tree.
* `examples/rust/Cargo.toml` declares the per-binary deps (wickra,
wickra-data with the `live-binance` feature always on, serde_json, tokio
for the macro and current-thread runtime).
* `examples/rust/src/bin/{backtest,fetch_btcusdt,live_binance}.rs` are the
three migrated binaries; their doc-comments and the fetch_btcusdt output
path are updated for the new location and run command
(`cargo run -p wickra-examples --bin <name>`).
* Workspace `Cargo.toml` lists the new member; the now-empty
`[dev-dependencies]` extras (`wickra`, `tokio` in wickra-data and
`serde_json` in wickra) that existed only for these examples are dropped.
* The `[[example]] live_binance` table is removed from wickra-data's
manifest since the file moved out.
* README "Languages" + project-layout, examples/README.md, Quickstart-Rust
and Data-Layer are pointed at the new paths and commands.
`cargo build -p wickra-examples` and `cargo run --release -p wickra-examples
--bin backtest -- examples/data/btcusdt-1d.csv` both succeed; the rest of
the workspace (core, data, wickra) builds, clippies (`--all-targets -D
warnings`) and tests (508 core + 28 data + 1 integration + 74+3+1
doctests) all stay green.
This commit is contained in:
@@ -119,17 +119,17 @@ exact contract.
|
||||
|
||||
## A deeper example
|
||||
|
||||
`crates/wickra/examples/backtest.rs` shipped with the workspace computes a
|
||||
panel of indicators (RSI, EMA, Bollinger, MACD, ATR, ADX, OBV) over an OHLCV
|
||||
CSV by way of `wickra-data`:
|
||||
`examples/rust/src/bin/backtest.rs` (in the `wickra-examples` workspace
|
||||
crate) computes a panel of indicators (RSI, EMA, Bollinger, MACD, ATR, ADX,
|
||||
OBV) over an OHLCV CSV by way of `wickra-data`:
|
||||
|
||||
```bash
|
||||
cargo run --release --example backtest -- path/to/ohlcv.csv
|
||||
cargo run --release -p wickra-examples --bin backtest -- path/to/ohlcv.csv
|
||||
```
|
||||
|
||||
For live-data work, `wickra-data` ships a streaming CSV reader, a
|
||||
tick-to-candle aggregator, a candle resampler, and a Binance kline WebSocket
|
||||
adapter under the `live-binance` feature. `crates/wickra-data/examples/live_binance.rs`
|
||||
adapter under the `live-binance` feature. `examples/rust/src/bin/live_binance.rs`
|
||||
is the canonical example for the latter.
|
||||
|
||||
## See also
|
||||
|
||||
Reference in New Issue
Block a user