Rust CLI

Native Rust performance directly from your terminal. No compilation needed — just install via pip and run anywhere.

Why Use the CLI?

⚡

Zero Overhead

Pure Rust execution with minimal memory footprint. Direct binding to the core engine.

đŸ“Ļ

No Build Needed

Pre-compiled for all major platforms. Installs instantly with `pip install`.

🔧

CI/CD Ready

Design for automated pipelines. JSON in, JSON out.

📜

Shell Scripting

Chain backtests in bash/zsh with standard process piping.

Installation

Terminal
# The CLI is automatically installed with rlxbt
pip install rlxbt

# Verify installation
rlx-cli --help
â„šī¸

Automatic Integration The command-line tools are smart enough to find the native engine regardless of whether you installed from PyPI or are working in a local development environment.

Commands

rules-backtest

Run backtest using JSON rules file — no pre-calculated signals needed.

Terminal
rlx-cli rules-backtest \
    --data data/BTCUSDT_1h_with_indicators.csv \
    --rules strategies/rsi_strategy.json \
    --capital 100000 \
    --commission 0.001 \
    --output results.json

Arguments

ArgumentDescriptionDefault
--dataCSV file with OHLCV + indicatorsRequired
--rulesJSON rules fileRequired
--capitalInitial capital100000
--commissionCommission rate0.0
--dashboardLaunch web dashboardfalse
--outputOutput JSON fileNone

info

Display information about a data file.

Terminal
rlx-cli info --data data/BTCUSDT_1h.csv

# Output: bar count, time range, available columns

rlx-graphPro

Advanced graph-based pattern backtester. Directly execute complex flow-charts strategies with high precision.

Terminal
rlx-graph --data data/BTCUSDT_1h_complex.csv --graph strategy.json

JSON Rules Format

Simple Format

rsi_strategy.json
{
  "entry_long": "RSI_14 < 30",
  "exit_long": "RSI_14 > 70",
  "entry_short": "RSI_14 > 70",
  "exit_short": "RSI_14 < 30"
}

Signals & Logic Format

In RLX, signals are defined in the entry_rules array. Each rule specifies a condition, a signal name for reporting, and a trade direction (1 for Long, -1 for Short).

institutional_strategy.json
{
  "entry_rules": [
    {
      // Condition: Multiple indicators + Account metrics
      "condition": "RSI_14 < 25 && Stoch_K < 20 && total_pnl > 0",
      "signal": "DeepOversoldLong",
      "direction": 1
    },
    {
      "condition": "close > EMA_12 && EMA_12 > EMA_26 && RSI_14 > 55",
      "signal": "MomentumTrendLong",
      "direction": 1
    }
  ],
  "exit_rules": [
    {
      "condition": "current_position_pnl / current_balance < -0.015",
      "reason": "PositionRiskExit"
    },
    {
      "condition": "bars_held > 30",
      "reason": "TimeExit"
    }
  ],
  "stop_loss_pct": 0.005,
  "take_profit_pct": 0.005
}

Example Output

Terminal Output
$ rlx-cli rules-backtest --data data/BTCUSDT_1h.csv --rules rules/btc_rsi.json

RLX Backtester v1.0.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Data: BTCUSDT_1h.csv (8,760 bars)
📋 Strategy: btc_rsi.json
💰 Initial Capital: $10,000.00

Running backtest... ████████████████████ 100% (0.02s)

═══════════════════════════════════════════════════
                    RESULTS
═══════════════════════════════════════════════════

Performance:
  Total Return:      +45.23%
  Sharpe Ratio:      1.87
  Sortino Ratio:     2.45
  Max Drawdown:      -12.34%
  Calmar Ratio:      3.67

Trading:
  Total Trades:      156
  Win Rate:          62.18%
  Profit Factor:     2.31
  Avg Trade:         +0.29%

Risk:
  VaR (95%):         -1.23%
  CVaR (95%):        -1.87%
  Ulcer Index:       4.56

Time: 0.006s | 6,586,343 bars/sec