Only open work is listed here. Completed items are removed.
Backend boundaries
q.bt currently provides native LEAN result reporting and an optional Lean CLI adapter. The longer-term design exposes a common research-facing result contract over two independent execution backends:
a QRT-owned in-process event kernel shared with q.gym;
an optional adapter that orchestrates the standalone Lean CLI and LEAN engine.
The backends may normalize summaries and trade logs, but they must not pretend to have identical execution semantics. Every result records its backend and backend-specific configuration. LEAN remains authoritative for its event loop, subscriptions, orders, fills, fees, buying power, settlement, portfolio state, native result JSON, and Report Creator output.
In-process QRT backend
Implement an event-driven execution kernel shared by batch backtests and q.gym without depending on Lean CLI or Docker.
Add q.bt.run(signal, prices, ...) for canonical QRT signals and OHLCV data. Define timing explicitly: signal availability, order submission, execution bar, mark-to-market timestamp, and prevention of look-ahead.
Define pluggable transaction-cost, spread, slippage, order-sizing, fill, and position-limit interfaces. Default models should be simple and explicit, never silently market-specific.
Emit the canonical QRT trade-log schema used by q.stats and q.plot, plus equity, cash, exposure, turnover, and rejected-order series.
Keep the in-process engine useful when Lean CLI is not installed. LEAN integration must not become a dependency of q.bt.run.
Result and artifact model
Parse summary JSON, engine and algorithm logs, order events, data-request reports, and the generated code snapshot into structured views attached to the existing LeanBacktestResult.
Preserve every native artifact path and checksum. Parsed QRT objects are derived views and must never replace or rewrite the source files.
Normalize run metadata, statistics, runtime statistics, charts/series, orders, order events, holdings, closed trades, parameters, and errors while retaining unknown fields for forward compatibility.
Convert LEAN closed trades/order events to QRT’s canonical trade log with a documented mapping. Preserve the original LEAN identifiers and expose conversion warnings when partial fills, assignments, multi-leg orders, or currency conversions cannot be represented losslessly.
Distinguish process success from research success. A zero CLI exit code can still accompany failed data requests, algorithm ERROR:: messages, invalid orders, unfilled final-session orders, or analyzer failures.
Add structured diagnostics with stable codes and severities for missing data, custom-market failures, model rejection, Docker problems, result parse drift, and report failures. Retain raw matching log lines as evidence.
Expose charts and tabular results in backend-neutral forms consumable by q.plot, but do not discard backend-specific chart metadata or precision.
Reports
Add backend-neutral adapters beyond LEAN result JSON while retaining the native q.bt.BacktestReport contract.
Add optional PDF export, custom HTML themes, and report-section selection to the native QRT reporter.
Normalize partial fills, assignments, multi-leg orders, and currency conversions with explicit conversion warnings.
Wrap lean report with exact result-file selection. Never pass a result directory or infer an arbitrary JSON when several candidates exist.
Support HTML and PDF destinations, strategy metadata, custom templates, overwrite policy, and local image selection while reflecting the actual Lean CLI options (lean report has --update, not --no-update).
Detect custom-market SIDs before invoking Report Creator. If compatibility conversion is required, write a derived copy under a separate artifact path and retain a manifest of every transformed field.
Never mutate the original backtest JSON. Report compatibility should be a pure transformation from source result to derived result plus an audit record.
Make order omission/aliasing explicit when working around upstream Report replay limitations. Surface which report sections lose reconstruction input, such as asset allocation, while preserving closed-trade statistics and charts.
Version compatibility transforms by LEAN engine and CLI version so a workaround is not applied after upstream behavior changes.
Reproducibility and provenance
Packaging and compatibility
Testing and acceptance criteria
Extend the existing command, path, state, result-selection, and native report unit tests with manifest redaction, structured log parsing, and compatibility transforms.
Use fake subprocesses for cancellation, timeout, partial output, malformed JSON, nonzero exit, and successful-process/failed-research combinations.
Run Docker integration tests only in an opt-in environment with pinned CLI and image versions.
Use lean/demo-generated-data as the golden custom-market workflow. The direct-data, universe, and SMA runs must preserve their verification markers, expected data-request counts, orders, and statistics within documented tolerances.
Verify report generation for an ordinary built-in market and the custom Sweden compatibility path. Assert that source result hashes are unchanged.
Demonstrate concurrent runs, deterministic artifact association, graceful cancellation, and reproduction from a saved manifest.
Back to top