QuantCraft documentation reference
QuantCraft ships two complementary kinds of documentation: in-app topics you read inside the IDE, and strategy reference Markdown bundled with the product for deeper API detail. Together they describe how to write strategies, run backtests, and use the IDE. These web docs mirror many of those topics — start with Introduction or Getting started.
Where to read docs in the app
- Open QuantCraft from the main app.
- Expand the right sidebar (if it is collapsed).
- Open the Documentation tab (alongside QuantCraft AI).
You land on a searchable index of topics. Type in the search box to filter by title, summary, or embedded keywords (for example on_finish, PaperAccount, chart_indicator_series).
Tap a topic card to open the full article. Use Back to return to the index.
Topic index (in-app)
Topics are grouped into two sections, matching the Documentation sidebar.
Getting started
| Topic | What you will learn |
|---|---|
| Fundamentals | Financial statement data, date-keyed tables, how fundamentals align to bars, and how to read them in a strategy. |
| Fama-French factors | Global monthly FF3/FF5 factor returns via fama_french.qc (Premium; no callback argument). |
| Calendar data | Dividends, splits, earnings dates and filings (calendar callback argument, backtests only) and corporate actions in the simulation. |
| Account | PaperAccount: balances, positions, orders, PnL, and performance metrics exposed during a backtest. |
| Life cycle | Callback order: on_init, on_bar, on_tick, optional on_timer (forward only), on_finish — including multi-symbol basics and optional full-series on_finish(bars). |
Reference
| Topic | What you will learn |
|---|---|
| Input parameters | Declaring quantcraft.inputs.params, types, and how values are supplied from run modals (backtest, bulk forward, chart forward). |
| Run presets (.qcs) | Save and reload run modal settings as .qcs files in your workspace. |
| Debugging | Debug Run vs Debug Test, breakpoints, stepping, call stack and variables. |
| AutoTrading | Local forward runs for algorithms and agents, New Bulk / Agent Bulk Run, and monitoring bulk / chart jobs. |
| QuantCloud | Bulk forward runs on cloud runners when your PC is off (desktop user guide). |
| Agents | Trading, Test and Optimization agents; building node graphs by hand or with the AI Builder; exposed parameters and optimization; backtest on paper, forward / live via connected broker; .qca import / export. |
| QuantCraft AI | The IDE AI chat, connecting a model (AI → API Providers), Screener tools, AI Tools, MCP servers, and AI Prompt nodes in agents. |
| QuantCraft Tools | Built-in read-only market tools the AI can call (chat, AI Prompt nodes, Test / Optimization agents). |
| OHLCV | Bar shape (OhlcvBarView), loaders (connected broker vs B2), time ranges, and using bar data in callbacks. |
| Indicator series | Building chart_indicator_series overlays (lines, histograms, panes) on backtest result charts. |
Any card in the index that does not open a full article yet is labeled Soon in the UI.
How the in-app docs relate to your workflow
Use this quick map when you are doing something in the IDE:
| You want to… | Start with |
|---|---|
| Configure symbols, dates, fundamentals, and run a simulation | Strategy lifecycle + OHLCV; then Running code (Test) and Test results. |
| Size positions, stops, or read Sharpe / drawdown | Account model |
| Let users tune thresholds without editing code | Input parameters |
| Plot custom series on the equity chart | Indicator series |
| Mix price and filings / statements | Fundamentals |
| Mix price and global factor returns | Fama-French factors |
| React to dividends / splits, or guard around earnings dates | Calendar data — calendar callback arg, days_to_earnings, corporate actions |
| Combine primary and secondary timeframes | OHLCV and bar data — Additional timeframes + rt.get_bar |
| Reuse backtest or forward modal settings | Run presets (.qcs) |
| Pause on a line and inspect variables | Debugging |
| Run algos forward on your own machine | AutoTrading |
| Run algos on a remote runner | QuantCloud |
| Build an automation from visual nodes | Agents |
The in-app articles are written for strategy authors and IDE users. Server operator setup for QuantCloud is not covered in these public docs.
Strategy imports
Write every import as quantcraft.*, with suffix-free module names (for example quantcraft.inputs, not quantcraft.inputs_module). The older ide.* and quantcraft.*_module paths still resolve, as does quantcraft.backtest.* — the package's former name before it was renamed to quantcraft.process.* — so existing strategies keep working unchanged — but do not write new code against them.
| Primary import | Older paths you may see | Used for |
|---|---|---|
quantcraft.process.runtime | quantcraft.backtest.runtime, ide.backtest.runtime | account, chart_indicators, qc_fundamentals, qc_fama_french, qc_calendar, get_bar (via import quantcraft.runtime as rt) |
quantcraft (Timeframe) | — | Timeframe enum for rt.get_bar(Timeframe.DAILY, shift=1) (primary and additional TFs) |
quantcraft.runtime | — | Same module as quantcraft.process.runtime, shorter spelling — import quantcraft.runtime as rt for rt.get_bar and the runtime handles |
quantcraft.timeframes | — | The Timeframe enum (also from quantcraft import Timeframe) |
quantcraft.inputs | ide.inputs_module, quantcraft.inputs_module | params from run modals |
quantcraft.process.ohlcv | quantcraft.backtest.ohlcv, ide.backtest.ohlcv_module, quantcraft.backtest.ohlcv_module | QcOhlcv, qc_ohlcv |
quantcraft.fundamentals | ide.fundamentals_module, quantcraft.fundamentals_module | QcFundamentals |
quantcraft.fama_french | ide.factors_module | QcFamaFrench, fama_french.qc |
quantcraft.account | quantcraft.process.account, quantcraft.backtest.account, ide.account_module, quantcraft.account_module | PaperAccount, OpenPosition |
quantcraft.process.indicator_series | quantcraft.backtest.indicator_series, ide.backtest.indicator_series_module, quantcraft.backtest.indicator_series_module | ChartIndicatorSeries, coerce_chart_time |
quantcraft.calendar_module | — | BacktestCalendar — passed as the calendar callback arg when calendar data is enabled; see Calendar data. The one module that keeps its _module suffix — there is no quantcraft.calendar. |
quantcraft.cross_sectional | — | Universe-wide ranking / z-scores — see below |
quantcraft.process | — | clamp_indicator_period |
Shorter re-exports also work: quantcraft.indicator_series, quantcraft.account. For Fama-French, prefer from quantcraft import fama_french and read fama_french.qc inside callbacks.
Fama-French row access: dataset["rows"] is a YYYYMM → values dict, not a list. Use .row(...) or .rows_chronological(...); latest_row(...) only in forward runs (in a backtest it is look-ahead — see Fama-French factors). Do not use rows[0] / rows[-1].
Do not use internal packages such as quantcraft.b2.* (the data-download layer behind the price and fundamentals loaders) or quantcraft.ai_assistant.* in strategy scripts — those are internal helpers, not the strategy API. Do not confuse quantcraft.process.ohlcv (strategy OHLCV API) with quantcraft.b2.ohlcv (internal data layer).
Cross-sectional helpers
quantcraft.cross_sectional has vectorized helpers for comparing many symbols at once (numpy): stack_field, latest_return, latest_sma, latest_std, latest_rsi, rank, zscore, demean, winsorize, plus ColumnarBarArena.
import quantcraft.runtime as rt
import quantcraft.cross_sectional as xs
def on_bar(bar_index, bar, symbol=None):
syms, close = xs.stack_field(rt.qc_ohlcv_by_symbol, "close")
momentum = xs.latest_return(close, 20) # per-symbol 20-bar return
score = dict(zip(syms, xs.rank(momentum))) # rank in [0, 1]Forward / bulk runs only as written. In a backtest,
rt.qc_ohlcv_by_symbolholds each symbol's whole loaded range, so "latest" there means the last bar of the test — look-ahead. In a backtest, collect each symbol's closes from itsbaras the run walks and feed those arrays to the helpers instead.
Module handles vs imported names
quantcraft.process.runtime and quantcraft.fama_french are module aliases, so attribute access reads the live per-session value:
import quantcraft.process.runtime as rt
import quantcraft.fama_french as ff
rt.account # this run's PaperAccount
rt.chart_indicators # this run's collector
ff.qc # this run's Fama-French loaderEverything else re-exports names by value, so from ... import <name> binds a snapshot taken at import time.
For the handles the engine assigns per run, the engine rebinds those names in the root algo file after loading it, so the from ... import form is safe there — for the names it rebinds:
- Backtest / Debug Test:
account,chart_indicators,get_bar,qc_ohlcv,qc_ohlcv_by_symbol,qc_ohlcv_by_tf,qc_fundamentals,qc_fama_french,qc_calendar. - Forward runs: only
account,qc_fundamentalsandqc_fama_french— so forchart_indicatorsand the OHLCV handles usert.<name>there.
# Fine in the root algo file — the engine rebinds these after loading your script
from quantcraft.process.runtime import account, qc_fundamentals, qc_fama_frenchA split helper module is different: it stays cached in sys.modules across runs in the same process, so an imported name keeps whichever session's handle was current at first import — stale for the next run (forward / bulk). In helper modules, import the module and use attribute access:
# helpers/signals.py — always read through the module
import quantcraft.process.runtime as rt
def record(sym, t, value):
rt.chart_indicators.add(...) # live handle for *this* runfrom quantcraft.inputs import params is the exception: params is one live object whose values change per run, so the from form is safe everywhere — see Input parameters.
Bundled strategy reference (Markdown)
For line-level module behavior, callback contracts, and engine details, the product also includes Markdown under the quantcraft-dev bundle (conceptually: “QuantCraft strategy reference”). A typical table of contents looks like this:
| Document | Focus |
|---|---|
| IMPORTS | quantcraft.* import paths (incl. quantcraft.cross_sectional), the older ide.* / quantcraft.backtest.* paths still resolved for existing scripts, and module handles vs imported names |
| BACKTEST_README | High-level backtest package overview |
| BACKTEST_ENGINE | Engine orchestration, config, callbacks, result payload |
| BACKTEST_MODULE | WebSocket backtest entry from the IDE |
| IDE_BACKTEST_RUNNER | Subprocess runner next to the Python service |
| RUNTIME | Runtime globals: account, chart_indicators, get_bar / primary and additional timeframes; per-session handles and rt.<name> access |
| INPUTS_MODULE | params wiring from run modals |
| RUN_CONFIG_QCS | .qcs run preset format and cross-modal mapping |
| ACCOUNT_MODULE | PaperAccount trading API, commission / slippage |
| OHLCV_MODULE | QcOhlcv loaders, bar in callbacks, secondary timeframes |
| INDICATOR_SERIES_MODULE | Chart series payload and helpers |
| FUNDAMENTALS_MODULE | Fundamentals JSON shape and API |
| FAMA_FRENCH | Global Fama-French factors / fama_french.qc / YYYYMM row dict |
| CALENDAR_MODULE | Dividends, splits, earnings dates (calendar callback arg); corporate actions in the simulation — user page is Calendar data |
| DEBUGGING | Debug Run / Debug Test, breakpoints, call stack and variables — user page is Debugging |
| AUTO_TRADING | Local forward runs (algo + agent bulk) and the New Run modal — user page is AutoTrading |
| QUANT_CLOUD | Algorithm bulk forward jobs on cloud runners — user page is QuantCloud |
| AGENTS | Trading / Test / Optimization agents, AI Builder, paper Test vs connected broker forward/live — user page is Agents |
| AI_ASSISTANT | The IDE AI chat, model providers, Screener tools, AI Tools, MCP servers — user page is QuantCraft AI |
| QUANTCRAFT_TOOLS | Built-in read-only market tools for the AI — user page is QuantCraft Tools |
| SCREENER | No-code and Python screens, presets, screener-driven runs — user page is Screener |
| POSSIBLE_ERRORS | Common errors and fixes — user page is Possible errors |
Those files are aimed at strategy authors who need exact names and contracts. Advanced topics such as BACKTEST_MODULE (WebSocket backtest entry) and IDE_BACKTEST_RUNNER (subprocess runner) are included in the bundle for contributors but are not primary user paths. QuantCraft AI in the IDE is preloaded with this material so answers stay aligned with the shipped modules.
Other help surfaces in QuantCraft
These are not the Documentation tab but are part of the same “reference ecosystem” for users:
- QuantCraft AI — Ask natural-language questions; answers can cite the same dev corpus. Connect a model under AI → API Providers (your own key, or QuantCraft Premium / hosted options).
- Import and export — Move
.py(and related) files between disk and the workspace. - Test results — Equity chart, metrics, trades, and HTML export after a backtest.
Search tips
- Prefer short tokens that appear in code:
on_finish,params,chart_indicator_series,coerce_chart_time,pane_id. - If nothing matches, clear the search — the index lists every topic by section.
- Cross-topic ideas (for example “fundamentals +
on_bar”) often need two articles: open Fundamentals for data shape, then Strategy lifecycle for when it is available.
Document history
In-app Documentation is maintained alongside the strategy runtime. When the Python modules or backtest payload change, the in-app topics and bundled Markdown are updated together so examples and names stay in sync. Strategy import examples are written with suffix-free quantcraft.* paths throughout; the older ide.*_module and quantcraft.*_module paths are documented only as a reading aid for existing scripts.
