dorq

paper in,
backtest out.

dorq turns a quantitative research paper into a backtested trading strategy. Drop in a PDF or a URL — a local LLM extracts the strategy, a deterministic engine runs it against real market data, and you see whether the idea actually beats buy-and-hold.

PDF / URL → docling → markdown → local ollama → StrategySpec → vectorbt + alpaca → analytics
1
Upload a paper

A PDF file or a URL (an arXiv link works). docling converts it to Markdown and dorq pulls out the abstract, methodology, and results sections.

2
Generate a strategy

Two modes. Spec mode (default): the model produces a structured StrategySpec — indicators, entry/exit rules, assets, date range — that a deterministic engine executes; no model-written code ever runs, and the conditions are editable before you run. Code mode: the model writes a pandas strategy() you can inspect and edit, executed in an AST-validated sandbox — no imports, no filesystem, no network.

3
Run the backtest

Adjust assets, date range, position sizing, stop loss / take profit, initial cash. Market data comes from Alpaca's free API; vectorbt simulates the portfolio. Run as many variations as you like.

4
Read the results

Total return against an equal-weight buy-and-hold benchmark, interactive equity and drawdown charts, Sharpe / Sortino / profit factor, a per-trade log with entry/exit markers on the price chart, run-by-run comparison — plus a chat panel for interrogating the paper and the strategy.

Local first
The LLM is your own Ollama instance. The only external call is Alpaca's market-data API. Nothing else leaves the machine.
No eval()
Strategy conditions are parsed by a fixed, narrow evaluator. Code-mode strategies run in an AST-allowlisted sandbox.
Keys stay server-side
All credentials come from the server environment. The client never sends — or sees — a key or a model name to configure.
Prerequisites
Python 3.12 (not 3.13+ — vectorbt/llvmlite) uv Ollama running locally Alpaca paper keys (free) Node 20+ (only to rebuild the UI)
1 · Clone & install
$ git clone https://github.com/unh0lymos3s/dorq.git
$ cd dorq
$ uv sync --dev
2 · Pick a model & set credentials
# any tag your Ollama serves — nothing is baked into the code
$ ollama pull <model>

# server env only — the client never sends keys (or use a .env file)
$ export DORQ_OLLAMA_MODEL=<model-tag>
$ export DORQ_ALPACA_API_KEY=...
$ export DORQ_ALPACA_SECRET_KEY=...

Prefer an Ollama cloud tag? Your local Ollama proxies it to ollama.com — run ollama signin once. LLM features return 503 ollama_not_configured until a model is set.

3 · Run
$ uv run uvicorn main:app --port 8000

Open http://localhost:8000 — the pre-built SPA in frontend/ is served by FastAPI.

4 · Rebuild the frontend (optional)
$ cd ui
$ npm install
$ npm run dev    # Vite dev server, proxies to :8000
$ npm run build  # emits ../frontend (served by FastAPI)
5 · Test
$ uv run pytest  # the Alpaca integration test is opt-in
DORQ_OLLAMA_MODELrequired — model tag Ollama serves; LLM features disabled until set
DORQ_OLLAMA_BASE_URLhttp://localhost:11434 — Ollama host
DORQ_ALPACA_API_KEYAlpaca market-data key — backtests disabled until set
DORQ_ALPACA_SECRET_KEYAlpaca secret
DORQ_LLM_TIMEOUT600 — per-request LLM timeout, seconds
DORQ_LOG_LEVELinfo — debug · info · warning · error · critical
DORQ_CORS_ORIGINS["*"] — allowed CORS origins, JSON array

Built with Claude.
dorq — the engine, the UI, and this page — was built with Claude Code by Anthropic.

dorq runs on Ollama.
Strategy extraction and paper Q&A are served by a single local Ollama instance — you bring whatever model your machine (or your ollama.com account) can run. No provider keys, no per-token bills, no paper leaves your box.