Documentation

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

  1. Open QuantCraft from the main app.
  2. Expand the right sidebar (if it is collapsed).
  3. 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

TopicWhat you will learn
FundamentalsFinancial statement data, date-keyed tables, how fundamentals align to bars, and how to read them in a strategy.
Fama-French factorsGlobal monthly FF3/FF5 factor returns via fama_french.qc (Premium; no callback argument).
Calendar dataDividends, splits, earnings dates and filings (calendar callback argument, backtests only) and corporate actions in the simulation.
AccountPaperAccount: balances, positions, orders, PnL, and performance metrics exposed during a backtest.
Life cycleCallback 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

TopicWhat you will learn
Input parametersDeclaring 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.
DebuggingDebug Run vs Debug Test, breakpoints, stepping, call stack and variables.
AutoTradingLocal forward runs for algorithms and agents, New Bulk / Agent Bulk Run, and monitoring bulk / chart jobs.
QuantCloudBulk forward runs on cloud runners when your PC is off (desktop user guide).
AgentsTrading, 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 AIThe IDE AI chat, connecting a model (AI → API Providers), Screener tools, AI Tools, MCP servers, and AI Prompt nodes in agents.
QuantCraft ToolsBuilt-in read-only market tools the AI can call (chat, AI Prompt nodes, Test / Optimization agents).
OHLCVBar shape (OhlcvBarView), loaders (connected broker vs B2), time ranges, and using bar data in callbacks.
Indicator seriesBuilding 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 simulationStrategy lifecycle + OHLCV; then Running code (Test) and Test results.
Size positions, stops, or read Sharpe / drawdownAccount model
Let users tune thresholds without editing codeInput parameters
Plot custom series on the equity chartIndicator series
Mix price and filings / statementsFundamentals
Mix price and global factor returnsFama-French factors
React to dividends / splits, or guard around earnings datesCalendar data — calendar callback arg, days_to_earnings, corporate actions
Combine primary and secondary timeframesOHLCV and bar data — Additional timeframes + rt.get_bar
Reuse backtest or forward modal settingsRun presets (.qcs)
Pause on a line and inspect variablesDebugging
Run algos forward on your own machineAutoTrading
Run algos on a remote runnerQuantCloud
Build an automation from visual nodesAgents

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 importOlder paths you may seeUsed for
quantcraft.process.runtimequantcraft.backtest.runtime, ide.backtest.runtimeaccount, 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.inputside.inputs_module, quantcraft.inputs_moduleparams from run modals
quantcraft.process.ohlcvquantcraft.backtest.ohlcv, ide.backtest.ohlcv_module, quantcraft.backtest.ohlcv_moduleQcOhlcv, qc_ohlcv
quantcraft.fundamentalside.fundamentals_module, quantcraft.fundamentals_moduleQcFundamentals
quantcraft.fama_frenchide.factors_moduleQcFamaFrench, fama_french.qc
quantcraft.accountquantcraft.process.account, quantcraft.backtest.account, ide.account_module, quantcraft.account_modulePaperAccount, OpenPosition
quantcraft.process.indicator_seriesquantcraft.backtest.indicator_series, ide.backtest.indicator_series_module, quantcraft.backtest.indicator_series_moduleChartIndicatorSeries, 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_symbol holds 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 its bar as 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 loader

Everything 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_fundamentals and qc_fama_french — so for chart_indicators and the OHLCV handles use rt.<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_french

A 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* run

from 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:

DocumentFocus
IMPORTSquantcraft.* import paths (incl. quantcraft.cross_sectional), the older ide.* / quantcraft.backtest.* paths still resolved for existing scripts, and module handles vs imported names
BACKTEST_READMEHigh-level backtest package overview
BACKTEST_ENGINEEngine orchestration, config, callbacks, result payload
BACKTEST_MODULEWebSocket backtest entry from the IDE
IDE_BACKTEST_RUNNERSubprocess runner next to the Python service
RUNTIMERuntime globals: account, chart_indicators, get_bar / primary and additional timeframes; per-session handles and rt.<name> access
INPUTS_MODULEparams wiring from run modals
RUN_CONFIG_QCS.qcs run preset format and cross-modal mapping
ACCOUNT_MODULEPaperAccount trading API, commission / slippage
OHLCV_MODULEQcOhlcv loaders, bar in callbacks, secondary timeframes
INDICATOR_SERIES_MODULEChart series payload and helpers
FUNDAMENTALS_MODULEFundamentals JSON shape and API
FAMA_FRENCHGlobal Fama-French factors / fama_french.qc / YYYYMM row dict
CALENDAR_MODULEDividends, splits, earnings dates (calendar callback arg); corporate actions in the simulation — user page is Calendar data
DEBUGGINGDebug Run / Debug Test, breakpoints, call stack and variables — user page is Debugging
AUTO_TRADINGLocal forward runs (algo + agent bulk) and the New Run modal — user page is AutoTrading
QUANT_CLOUDAlgorithm bulk forward jobs on cloud runners — user page is QuantCloud
AGENTSTrading / Test / Optimization agents, AI Builder, paper Test vs connected broker forward/live — user page is Agents
AI_ASSISTANTThe IDE AI chat, model providers, Screener tools, AI Tools, MCP servers — user page is QuantCraft AI
QUANTCRAFT_TOOLSBuilt-in read-only market tools for the AI — user page is QuantCraft Tools
SCREENERNo-code and Python screens, presets, screener-driven runs — user page is Screener
POSSIBLE_ERRORSCommon 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.