A Rust-based cryptocurrency trading and backtesting system. Fetches historical market data, runs configurable backtests with technical indicators, and simulates position management with entry protection rules.
Cargo workspace with 8 member crates (Rust nightly, edition 2024):
| Member | Path | Description |
|---|---|---|
qtrade (binary) |
app/qtrade |
Entrypoints: S_Backtest, S_Real (stub), S_Futuretest (stub) |
macd |
libs/analyse/strategy/macd |
MACD strategy implementation & backtest_macd() |
strategy |
libs/analyse/strategy/strategy |
Strategy enum |
common |
libs/exchange/common |
Shared types: Kline, Direction, PositionResult, Exchange |
binance |
libs/exchange/binance |
Binance REST client (get_binance_klines_spot) |
order |
libs/order |
Position management, entry protection, PnL tracking |
config |
libs/config |
TOML + env var configuration, tracing init |
exit-code |
libs/exit-code |
Exit code constants |
External dependency: qtrade-indicators — MACD, Supertrend, ATR, Williams Fractals, Median Price.
Additional assets:
Rust Project at app/qtrade.
PineScript indicators at app/tradingview/.
C++23 project at app/qtrade-cpp/ (no longer maintained).
# Build
cargo build -p qtrade
./S_Real
./S_Futuretest
./S_BacktestConfiguration is loaded from config/setting.toml (error if missing) with environment variable overrides via QTRADE__<SECTION>__<KEY>.
docker compose up qtrade-real
docker compose up qtrade-futuretest
docker compose up qtrade-backtest
docker compose --profile real up qtrade-real
docker compose --profile futuretest up qtrade-futuretest
docker compose --profile backtest up qtrade-backtestAGPL-3.0