GitHub
Source, tests, strategies and examples included.
git clone https://github.com/QuantJourneyOrg/quantjourney-bt.gitAn 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
Bundled data. No account or API key.
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 guideYour observations. The same strategy engine.
./strategy.sh example_weights_01_sma_daily \
--data-file /path/to/your/prices.csv \
--csv-config --output reports/local_csv Source checkout: CSV, Parquet, or a pandas DataFrame. Local input support is not yet released on PyPI.
Read the local input guidePrepared data through QuantJourney Cloud.
./strategy.sh example_weights_01_sma_daily \
--output reports/cloud Requires QuantJourney Cloud credentials and data access. Strategy calculations still run on your machine.
Set up Cloud accessClone the full repository or add the same engine directly to your Python workflow.
Source, tests, strategies and examples included.
git clone https://github.com/QuantJourneyOrg/quantjourney-bt.gitInstall into any Python project with pip.
pip install quantjourney-btA return curve starts the review. Data, timing, execution, and validation explain whether the result deserves another look.
Explore the research workflowDefine the universe, signal, trading interval, and rebalance rule before you inspect the result.
Follow the research workflowInspect commissions, slippage, turnover, and position sizing. State the funding and borrow assumptions your strategy needs.
Review execution costsUse walk-forward folds and separate validation periods. Review parameter sensitivity and statistical diagnostics before trusting a tuned run.
Inspect walk-forward validationInspect the return path, drawdowns, holdings, trades, and run metadata together. Keep the assumptions with the report.
Open a complete exampleReview validation, performance, allocation, and risk. Open the full gallery for the remaining diagnostics.
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
Five US equities · 2015-01-01 — 2025-01-01
Archived engine v0.9.1 · source: yfinance
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.
Strategy and benchmark path from the same configured report window.
Depth and duration of losses behind the headline return.
Target exposure by instrument through the report window.
Which assets drive portfolio risk in this run.
Rolling risk-adjusted performance from the report.
Open composition, volatility, turnover, underwater, and other diagnostics in the full report gallery.
The GitHub link opens the current example. See the archived run configuration for this packet.
Start with vectorized portfolio research or move to order-aware EOD simulation when execution logic matters.
Portfolio research for allocation strategies. Signals become target weights across a portfolio. Best for factor, ranking, rotation and scheduled rebalancing.
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",
)EOD execution for trade-aware strategies. Use orders, sizing, stops, take-profit and brackets when execution behavior matters.
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",
)These excerpts show the strategy hooks. Use the complete examples for signal gating, position checks, data, costs, execution settings, and the run entry point.
Hold each sector ETF only when SMA(50) is above SMA(200).
Enter on SMA trend and attach take-profit plus stop-loss exits.
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.
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.
simplest starter
Classic trend-following with a clean signal-to-weight conversion and report output.
portfolio weights
Ranks sector ETFs by trailing return, holds the strongest names and rebalances monthly.
order-aware execution
Buys oversold conditions with limit entries, exits with stops and reviews the blotter.
risk overlay
Scales exposure through time to keep the portfolio near a target volatility budget.
parameter search
Uses Optuna TPE while separating parameter search, study diagnostics and out-of-sample validation.
validation / OOS
Separates slice diagnostics from date-bounded per-fold execution with rolling or anchored folds and pre-OOS purging.
FREE gives you control over local research. PRO adds a managed workspace. Enterprise brings integration and scale. PRO and Enterprise will be available soon.
Build and validate locally.
Organize research, experiments and managed data.
Deploy, integrate and scale across your organization.
Yes. The bundled sample mode runs without an account. The source checkout also supports your local observations without Cloud credentials.
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.
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.
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.
The local engine is available now. The hosted workspace is coming soon. Contact QuantJourney for current PRO and private access.