This release is a pre-release and may not be stable for production use.
Quantcraft
Quantcraft is a Python backtesting and quant research toolkit focused on a polished first-beta single-symbol historical backtesting workflow.
The first public beta target is 0.1.0b1. It is built for users who want to
load OHLCV history, author a compact strategy, run a deterministic backtest,
inspect result.report, visualize result.plot(), compare a small finite
parameter grid, and run rolling walk-forward validation without learning the
internal repository workflow first.
Beta Scope
Current first-beta scope:
- single-symbol, single-timeframe historical OHLCV backtesting
- long-or-flat strategy workflows
DataFrameDataSource,CSVDataSource,CCXTDataSource,TimeBar, andBarSeriesStrategy,ta,qc,ParameterStudy, andWalkForwardStudyBacktestEngine.run(source=..., strategy=StrategyClass, config=...)BacktestEngine.run(bars=..., strategy=StrategyClass, config=...)- market, limit, stop-market, and stop-limit orders
- fixed quantity and
qty_percentsizing - conservative reservation, fills, positions, reporting, plotting, finite grid parameter exploration, and rolling walk-forward validation
Unsupported in the first public beta:
- live trading
- paper trading
- shorting
- leverage or margin
- multi-symbol portfolios
- multi-timeframe strategies
- trading recommendations or optimizer claims
Installation
Requirements:
- Python 3.12
uvfor local contributor setup
Package-user installation for the first beta will use the published package
once 0.1.0b1 is released:
uv add quantcraft==0.1.0b1
From a local checkout today:
uv sync
uv run poe check
Useful targeted checks:
uv run poe repo-check
uv run poe mutation-gates
uv run pytest tests/smoke/local -q
Live tests are excluded from the default check lane and must be run explicitly when needed.
Quickstart
from quantcraft.backtest import BacktestEngine, CostConfig
from quantcraft.data import DataFrameDataSource
from quantcraft.research import qc, ta
from quantcraft.strategy import Strategy
class SmaCrossStrategy(Strategy):
def init(self) -> None:
self.fast = ta.sma(self.data.close, length=2)
self.slow = ta.sma(self.data.close, length=3)
def on_bar(self, bar) -> None:
if qc.is_na(self.fast[0]) or qc.is_na(self.slow[0]):
return
if qc.crossover(self.fast, self.slow):
self.buy(quantity=1.0, tag="sma-entry")
elif self.position.is_open and qc.crossunder(self.fast, self.slow):
self.sell(quantity=1.0, tag="sma-exit")
source = DataFrameDataSource(
frame=[
{"timestamp": "1970-01-01T00:01:00+00:00", "open": 10.0, "high": 12.0, "low": 8.0, "close": 10.0, "volume": 1.0},
{"timestamp": "1970-01-01T00:02:00+00:00", "open": 9.0, "high": 11.0, "low": 7.0, "close": 9.0, "volume": 1.0},
{"timestamp": "1970-01-01T00:03:00+00:00", "open": 8.0, "high": 10.0, "low": 6.0, "close": 8.0, "volume": 1.0},
{"timestamp": "1970-01-01T00:04:00+00:00", "open": 11.0, "high": 13.0, "low": 9.0, "close": 11.0, "volume": 1.0},
{"timestamp": "1970-01-01T00:05:00+00:00", "open": 12.0, "high": 14.0, "low": 10.0, "close": 12.0, "volume": 1.0},
],
symbol="BTC/USDT",
timeframe="1m",
)
engine = BacktestEngine(
initial_cash=1_000.0,
costs=CostConfig(tick_size=1.0, slippage_ticks=0.0, fee_rate=0.0),
)
result = engine.run(source=source, strategy=SmaCrossStrategy, label="sma-cross")
print(result.report)
figure = result.plot()
result.report provides structured run, return, risk, trade, cost, exposure,
fill, and closed-trade information. result.plot() returns a Matplotlib figure
with price, fills, equity, and drawdown panels.
Examples
The first public beta has exactly three canonical examples:
- SMA crossover quickstart
- Orders and sizing
- Parameter exploration
Documentation
Public user documentation lives under docs/site. Start with:
Contributing
See CONTRIBUTING.md for local setup, check, docs expectations, pull request guidance, and AI-assisted contribution ownership requirements.
Security
See SECURITY.md for vulnerability reporting, secrets handling, and financial safety boundaries.
Financial Disclaimer
Quantcraft is research and software tooling, not financial advice. Backtest results do not guarantee future performance. You are responsible for data quality, assumptions, execution risk, and trading decisions.
License
Quantcraft is licensed under the MIT license.
Metadata
Release files for quantcraft 0.1.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quantcraft-0.1.0b1.tar.gz | 53.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quantcraft-0.1.0b1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 132.1 kB
Release files / quantcraft-0.1.0b1.tar.gz
| Download URL | quantcraft-0.1.0b1.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ba849f0073140f88660cb016004545340f2407f8e3fa95fb9e4789402843cce
|
|
BLAKE2b-256 checksum How to use checksums |
92e99ffee6deadc90fc120d3a1d404163d180ac98771c9e5d07da4d19238b68e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / quantcraft-0.1.0b1-py3-none-any.whl
| Download URL | quantcraft-0.1.0b1-py3-none-any.whl |
|---|---|
| Size | 78.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35d1e77f6ff051109957d89654a262e3c45bda88371145553a0932c7496a926e
|
|
BLAKE2b-256 checksum How to use checksums |
d879ae4b87f2b34ca183b9e1afebe4d53b62132581bcde1486b1bf722b8bdbe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency log