QuantJourney Backtester

QuantJourney Backtester

Share product feedback

✓

Thank you.

Your note is now in the QuantJourney inbox.

Backtests are easy.
Defensible research is hard.

An open-source Python backtesting engine for portfolio research, realistic execution, optimization, and out-of-sample validation.

Apache 2.0 · Local compute · No key for sample data

Daily SMA trend.

9 sector ETFs · 2000-01-03 — 2026-01-01

Archived daily SMA trend cumulative return chart, including its benchmark
CAGR
7.38%
Max DD
-34.68%
Total return
536.96%

Run your first
backtest.

Bundled data. No account or API key.

macOS / Linux
git clone https://github.com/QuantJourneyOrg/quantjourney-bt.git
cd quantjourney-bt
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[data,reports]"

./strategy.sh example_weights_01_sma_daily \
  --sample-data --quiet --output reports/sample

The setup guide includes Windows commands, supported Python versions, and expected output.

Open the setup guide

Install the Backtester

Clone the full repository or add the same engine directly to your Python workflow.

GitHub

Source, tests, strategies and examples included.

git clone https://github.com/QuantJourneyOrg/quantjourney-bt.git

Python Package

Install into any Python project with pip.

pip install quantjourney-bt

Build and validate
a strategy

A return curve starts the review. Data, timing, execution, and validation explain whether the result deserves another look.

Explore the research workflow
DataStrategyEvidence
01

Define the strategy

Define the universe, signal, trading interval, and rebalance rule before you inspect the result.

UniverseSignalTiming
Follow the research workflow
02

Model execution costs

Inspect commissions, slippage, turnover, and position sizing. State the funding and borrow assumptions your strategy needs.

FillsCostsSizing
Review execution costs
03

Validate out of sample

Use walk-forward folds and separate validation periods. Review parameter sensitivity and statistical diagnostics before trusting a tuned run.

SearchValidateStress
Inspect walk-forward validation
04

Inspect the report

Inspect the return path, drawdowns, holdings, trades, and run metadata together. Keep the assumptions with the report.

MetricsPlotsMetadata
Open a complete example

Inspect a backtest report

Review validation, performance, allocation, and risk. Open the full gallery for the remaining diagnostics.

Walk-forward validation

Evaluate performance beyond the training window. Compare training and held-out results across rolling folds.

The research guide explains date-bounded execution, purge gaps, and the assumptions behind an out-of-sample claim.

Inspect walk-forward validation
Training-window and held-out-window Sharpe ratios across rolling walk-forward folds
Separate research example from the walk-forward guide. The chart compares training and held-out windows.

CloudSMA 50/200 report

Five US equities · 2015-01-01 — 2025-01-01
Archived engine v0.9.1 · source: yfinance

Total return
+1505.7%
Ann. return
+32.0%
Sharpe
1.30
Max DD
-27.1%
Profit factor
9.68

Illustrative historical backtest from one configured research run — not live or investable performance. Results depend on the selected universe, period, data and modeled execution and cost assumptions; see the full packet for details. Past performance does not predict future results.

SMA 50/200 cumulative performance plot

Cumulative performance

Strategy and benchmark path from the same configured report window.

SMA 50/200 drawdown plot

Drawdown

Depth and duration of losses behind the headline return.

SMA 50/200 portfolio allocation plot

Portfolio allocation

Target exposure by instrument through the report window.

SMA 50/200 risk contribution plot

Risk contribution

Which assets drive portfolio risk in this run.

SMA 50/200 rolling sharpe plot

Rolling Sharpe

Rolling risk-adjusted performance from the report.

The GitHub link opens the current example. See the archived run configuration for this packet.

Write weight or order strategies

Start with vectorized portfolio research or move to order-aware EOD simulation when execution logic matters.

Weight Mode

Portfolio research for allocation strategies. Signals become target weights across a portfolio. Best for factor, ranking, rotation and scheduled rebalancing.

Python / API excerpt
from backtester import Backtester

class SMACrossover(Backtester):
    def _compute_signals(self):
        close = self.instruments_data.get_feature("adj_close")
        fast = close.rolling(50).mean()
        slow = close.rolling(200).mean()
        return (fast > slow).astype(float).fillna(0.0)

    def _compute_weights(self):
        signals = self.instruments_data.get_feature(
            "strategies", self.strategy_name, "signals"
        )
        active = signals == 1
        n_active = active.sum(axis=1)
        return active.div(n_active, axis=0).fillna(0.0)

strategy = SMACrossover(
    instruments=["AAPL", "MSFT", "GOOGL", "AMZN", "NVDA"],
    backtest_period={"start": "2015-01-01", "end": "2025-01-01"},
    initial_capital=100_000,
    execution_mode="weights",
)
Inspect the complete weight strategy

Order Mode

EOD execution for trade-aware strategies. Use orders, sizing, stops, take-profit and brackets when execution behavior matters.

Python / API excerpt
from backtester import Backtester

class BracketTrendEntry(Backtester):
    def _compute_signals(self):
        close = self.instruments_data.get_feature("adj_close")
        sma_200 = close.rolling(200).mean()

        return (close > sma_200).astype(float).fillna(0.0)

    def _compute_orders(self, date, bars, current_positions, nav):
        self.bracket_percent(
            "AAPL",
            weight=0.20,
            take_profit=0.10,
            stop_loss=0.05,
        )

strategy = BracketTrendEntry(
    instruments=["AAPL"],
    backtest_period={"start": "2020-01-01", "end": "2025-01-01"},
    initial_capital=100_000,
    execution_mode="orders",
)
Inspect the complete order strategy

These excerpts show the strategy hooks. Use the complete examples for signal gating, position checks, data, costs, execution settings, and the run entry point.

Open a complete strategy example

Browse all 50 examples

Rolling Walk-Forward Validation

Run a normal SMA(50/200) trend strategy, then inspect its temporal robustness with a ROLLING walk-forward and an explicit pre-OOS purge gap.

Explore runnable strategy examples

The free catalog covers weight and order modes, market to OCO orders, risk models, intraday workflows, futures, FX and walk-forward optimization. Open a result and inspect its exact source.

SMA Crossover visual output

SMA Crossover

Signal-BasedBeginner

simplest starter

Classic trend-following with a clean signal-to-weight conversion and report output.

  • 7.38% CAGR
  • 0.45 Sharpe
  • -34.68% Max DD
View packet
Momentum Rotation visual output

Momentum Rotation

Weight-BasedIntermediate

portfolio weights

Ranks sector ETFs by trailing return, holds the strongest names and rebalances monthly.

  • 0.05% CAGR
  • -0.24 Sharpe
  • -25.38% Max DD
View packet
RSI Mean-Reversion visual output

RSI Mean-Reversion

Order-BasedIntermediate

order-aware execution

Buys oversold conditions with limit entries, exits with stops and reviews the blotter.

  • 2.70% CAGR
  • 0.14 Sharpe
  • -19.09% Max DD
View packet
Volatility Targeting visual output

Volatility Targeting

Risk OverlayAdvanced

risk overlay

Scales exposure through time to keep the portfolio near a target volatility budget.

  • 5.35% CAGR
  • 0.36 Sharpe
  • -28.87% Max DD
View packet
Optuna Optimization visual output

Optuna Optimization

OptimizationAdvanced

parameter search

Uses Optuna TPE while separating parameter search, study diagnostics and out-of-sample validation.

  • TPE sampler
  • WF validation
  • Trial evidence
View packet
Walk-Forward Case Study visual output

Walk-Forward Case Study

ValidationDeep Dive

validation / OOS

Separates slice diagnostics from date-bounded per-fold execution with rolling or anchored folds and pre-OOS purging.

  • Slice vs per-fold
  • Pre-OOS purge
  • OOS fold evidence
View packet

One engine. From individual research to institutional scale.

FREE gives you control over local research. PRO adds a managed workspace. Enterprise brings integration and scale. PRO and Enterprise will be available soon.

FREE

Build and validate locally.

  • The complete Apache 2.0 engine
  • Weight and order execution
  • Optuna and walk-forward validation
  • Metrics, plots and run metadata
Start locally

PRO

Organize research, experiments and managed data.

  • Experiment tracking and reproducible runs
  • Visual workflows and out-of-sample comparison
  • Your own data or optional Data Gateway services
  • Market data and company fundamentals by agreement
Explore PRO

Enterprise

Deploy, integrate and scale across your organization.

  • Private deployment on your company's data
  • Internal systems, portfolio and risk integration
  • Permissions, audit trail and isolated execution
  • Scheduled and distributed research workloads
Talk to QuantJourney

Setup and data questions

Read the full setup guide
Can I run without an API key?

Yes. The bundled sample mode runs without an account. The source checkout also supports your local observations without Cloud credentials.

Can I use CSV, Parquet, or a DataFrame?

Yes, from the source checkout with local input support. It accepts daily USD equity observations with adjusted OHLC prices. Parquet needs the optional reader. Read the input contract.

Who selects the universe and dates?

The strategy keeps its configured symbols and period. The daily SMA example can use the explicit --csv-config shortcut to take both from its input.

Does a good backtest validate the strategy?

A historical result depends on its data, timing, costs, and selection process. Review those assumptions, validation periods, and failure cases. Custom inputs remain your responsibility.

Is the hosted workspace available?

The local engine is available now. The hosted workspace is coming soon. Contact QuantJourney for current PRO and private access.

Run a sample backtest

Run your first backtest