Skip to content

Quickstart

Five minutes from clone to a running paper-traded strategy. The full canonical version lives at QUICKSTART.md at the repo root — that file is the source of truth and gets updated with every release.

1. Build qkt

Requires JDK 21+.

git clone https://github.com/elitekaycy/qkt
cd qkt
./gradlew installDist
export PATH="$PWD/build/install/qkt/bin:$PATH"
qkt --version

You should see qkt 0.47.1 or later.

2. Write your first strategy

Create momentum.qkt in your working dir:

momentum.qkt
STRATEGY momentum VERSION 1

SYMBOLS
    btc = BACKTEST:BTCUSDT EVERY 1m

RULES
    WHEN btc.close > 100
    THEN BUY btc SIZING 0.1
         BRACKET {
           STOP_LOSS BY 2 PCT,
           TAKE_PROFIT BY 4 PCT
         }

The BACKTEST: prefix means "no live broker" — orders fill against an in-process paper broker.

3. Backtest it

qkt backtest momentum.qkt \
    --data-root data/sample \
    --from 2024-01-15 --to 2024-01-17 \
    --report-dir ./out

Outputs:

  • out/result.json — machine-readable metrics
  • out/equity_global.csv, out/trades.csv — raw market/trade data
  • out/financing.csv — swap paid and its signed P&L impact; add netPnlImpact to trade realized values when reconciling CSV totals
  • out/report.html — single self-contained HTML with equity curve, drawdown table, Monte Carlo fan, per-trade risk

Open out/report.html in a browser.

4. Run it as a daemon

qkt daemon &                                  # starts the control plane
qkt deploy momentum.qkt --as momentum
qkt list                                      # shows momentum running
qkt status momentum                           # current PnL, positions, last trade
qkt logs momentum --follow                    # live log stream
qkt resync momentum.qkt --as momentum --dry-run # validate an edited file
qkt resync momentum.qkt --as momentum         # replace only this running name
qkt stop momentum
qkt daemon stop

State (logs, control port) lives at ~/.local/state/qkt/ by default; override with QKT_STATE_DIR.

Next