Skip to content

docs(examples): add 3 end-to-end strategy examples (Rust + Python)#65

Open
kingchenc wants to merge 1 commit into
mainfrom
feat/strategy-examples
Open

docs(examples): add 3 end-to-end strategy examples (Rust + Python)#65
kingchenc wants to merge 1 commit into
mainfrom
feat/strategy-examples

Conversation

@kingchenc
Copy link
Copy Markdown
Owner

Summary

Three runnable strategy examples that wire Wickra indicators into complete signal → fill → PnL → equity loops over the checked-in BTCUSDT datasets, with per-trade Sharpe and max-drawdown reported on stdout.

Strategy Indicators Data Note
RSI Mean-Reversion RSI(14) btcusdt-1h.csv RSI < 30 / > 70 entries; binary position
MACD + ADX Filter MACD(12,26,9), ADX(14) btcusdt-1h.csv crossover entries gated by ADX > 20
Bollinger Squeeze Breakout BollingerBands(20,2), ATR(14) btcusdt-1d.csv 6-month low bandwidth + upper-band break, ATR×2 stop

Each strategy is implemented in both Rust and Python (6 files total).

Why

Closes the gap where existing examples showed only mechanics of calling `update`/`batch` but not how Wickra plugs into a complete trading-system shape. The point is not to be live-tradable strategies — every script prints a NOT-financial-advice notice next to its results.

Implementation notes

  • 0.1% fee per trade applied to both entry and exit (Binance maker tier baseline).
  • Equity curve is mark-to-market on every bar, so the max-drawdown metric reflects open-trade pain, not just closed-trade swings.
  • print_summary is inlined per script (not factored out into a shared module) so each example stays a single-file read.
  • Rust: `-D clippy::pedantic` clean.

Conflict status

Independent of #59, #60, #61, and the 4 just-opened PRs (#62 #63 #64). Only adds files under `examples/`.

CI expectation

29 + wasm-test job (if #64 has landed first) = 30. `cargo build -p wickra-examples --bins` covers the new bins automatically (no Cargo.toml change needed).

Wires real indicators into complete signal -> fill -> PnL -> equity
loops over the checked-in BTCUSDT datasets, with per-trade Sharpe and
max-drawdown reported on stdout. Closes the gap where existing
examples showed only the mechanics of calling `update`/`batch` but not
how Wickra plugs into a trading-system shape.

Three strategies, each in Rust + Python (six files total):

- strategy_rsi_mean_reversion — RSI(14) thresholds (30/70) on 1h
  BTCUSDT. Binary position, 0.1% per-trade fee.
- strategy_macd_adx — MACD crossover entries gated by ADX(14) > 20 on
  1h BTCUSDT. Trend-follower demo of multi-indicator gating.
- strategy_bollinger_squeeze — Bollinger-bandwidth 180-day-low squeeze
  + upper-band breakout entry, ATR(14) * 2 stop. On 1d BTCUSDT for
  interpretable lookback.

Each file is self-contained — print_summary is inlined per script so
the example stays a single-file read. Every script prints a
NOT-financial-advice notice next to its results.

examples/README.md updated to list the new bins/scripts.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant