|
| 1 | +--- |
| 2 | +name: universal_runner |
| 3 | +description: Instructions for operating the QuanuX Universal Runner (quanux_runner) for Live Trading and Offline Backtesting. |
| 4 | +--- |
| 5 | + |
| 6 | +# Universal Runner Operator Guide |
| 7 | + |
| 8 | +The `quanux_runner` is the core C++ execution engine for QuanuX. Use this skill to execute strategies, run backtests, or deploy to live markets. |
| 9 | + |
| 10 | +## 1. Capabilities |
| 11 | +* **Offline Replay**: High-performance replay of Databento `.dbn` files (MBO/L3 supported). |
| 12 | +* **Rithmic Replay**: Historical tick replay via RApi+ (Trade info). |
| 13 | +* **Live Trading**: Direct connection to Databento Live API via `libdatabento` or Rithmic RApi+. |
| 14 | +* **Zero-Copy Execution**: Loads strategies as shared objects (`.dylib`/`.so`) for maximum speed. |
| 15 | + |
| 16 | +## 2. Usage |
| 17 | + |
| 18 | +### Location |
| 19 | +Binary is located at: `execution-node/cpp/build/quanux_runner` |
| 20 | + |
| 21 | +### CLI Arguments |
| 22 | +| Argument | Required | Description | |
| 23 | +| :--- | :--- | :--- | |
| 24 | +| `--strategy <path>` | **Yes** | Path to the compiled strategy shared object (`.dylib`/`.so`). | |
| 25 | +| `--file <path>` | No* | Path to input `.dbn` file (Offline Mode). *Required for Backtesting.* | |
| 26 | +| `--key <key>` | No* | Databento API Key. *Required for Live Mode.* | |
| 27 | +| `--symbol <sym>` | No | Symbol to subscribe to (default: `ES`). | |
| 28 | +| `--dataset <ds>` | No | Dataset (default: `GLBX.MDP3`). | |
| 29 | +| `--ruser <u>` | No* | Rithmic Username. *Required for Rithmic.* | |
| 30 | +| `--rpass <p>` | No* | Rithmic Password. *Required for Rithmic.* | |
| 31 | +| `--rexch <e>` | No | Rithmic Exchange (e.g., `CME`). *Required for Rithmic.* | |
| 32 | +| `--start <ts>` | No | Start Timestamp (Unix Epoch). *Required for Replay.* | |
| 33 | +| `--end <ts>` | No | End Timestamp (Unix Epoch). *Required for Replay.* | |
| 34 | + |
| 35 | +### Examples |
| 36 | + |
| 37 | +#### A. Run Offline Backtest (Recommended) |
| 38 | +Use this to verify strategy logic using historical data. Zstd decompression is handled automatically if the runner was linked correctly. |
| 39 | +```bash |
| 40 | +./execution-node/cpp/build/quanux_runner \ |
| 41 | + --strategy execution-node/cpp/build/demo_strategy.dylib \ |
| 42 | + --file data/raw/glbx-mdp3-20260122.mbo.dbn |
| 43 | +``` |
| 44 | + |
| 45 | +#### B. Run Live Mode |
| 46 | +Requires `DATABENTO_API_KEY` (env var or arg). |
| 47 | +```bash |
| 48 | +export DATABENTO_API_KEY=db-xc... |
| 49 | +./execution-node/cpp/build/quanux_runner \ |
| 50 | + --strategy execution-node/cpp/build/demo_strategy.dylib \ |
| 51 | + --symbol ESH6 |
| 52 | +``` |
| 53 | + |
| 54 | +#### C. Run Rithmic Replay |
| 55 | +Replay historical trades from Rithmic servers. |
| 56 | +```bash |
| 57 | +./execution-node/cpp/build/quanux_runner \ |
| 58 | + --strategy execution-node/cpp/build/demo_strategy.dylib \ |
| 59 | + --ruser "DEMO_USER" \ |
| 60 | + --rpass "DEMO_PASS" \ |
| 61 | + --symbol "ES.M24" \ |
| 62 | + --rexch "CME" \ |
| 63 | + --start 1715000000 \ |
| 64 | + --end 1715003600 |
| 65 | +``` |
| 66 | + |
| 67 | +## 3. Workflow Checklist |
| 68 | + |
| 69 | +Before running, ensure: |
| 70 | +1. **Strategy Built**: The strategy must be compiled freshly. |
| 71 | + * `cmake --build execution-node/cpp/build --target <strategy_name>` |
| 72 | +2. **Runner Built**: The host binary must be up to date. |
| 73 | + * `cmake --build execution-node/cpp/build --target quanux_runner` |
| 74 | +3. **Data Ready**: For offline mode, ensure the `.dbn` file exists and is readable. |
| 75 | + |
| 76 | +## 4. Troubleshooting |
| 77 | + |
| 78 | +* **Exit Code 139 (Segfault)**: |
| 79 | + * Usually means the strategy is crashing (e.g., indicator out of bounds). |
| 80 | + * **Fix**: Add `std::cout` logs to `on_market_data` in the strategy and rebuild to isolate the crash. |
| 81 | +* **"Symbol not found"**: |
| 82 | + * The strategy `.dylib` is missing symbols or ABI mismatch. |
| 83 | + * **Fix**: Ensure `extern "C" { Strategy* create_strategy() ... }` is strictly defined in the strategy source. |
| 84 | +* **"Invalid argument 'key'"**: |
| 85 | + * API Key is missing or invalid in Live Mode. |
0 commit comments