FAQ · Getting systematic research right

How do I reproduce a backtest result months later?

Keep everything the result depended on: the exact data file, the strategy code at a commit, every setting including the random seed, and the engine and library versions. Store a hash of the result beside them. Months later, rerun from those and compare hashes: identical means reproduced, different means one of the inputs changed, and the stored copies say which.

Keep everything the result depended on: the exact data file, the strategy code at a commit, every setting including the random seed, and the engine and library versions. Store a hash of the result beside them. Months later, rerun from those and compare hashes: identical means reproduced, different means one of the inputs changed, and the stored copies say which.

What silently changes

  • Data. Vendors revise history: late prints, corrected bars, new split and dividend adjustments every time a company pays one. Re-downloading "the same" data months later usually gives a slightly different file.
  • Code. A small edit made for another experiment changes the strategy the old result came from.
  • Settings. Costs, lookback, date range, seed. Defaults change between library versions.
  • Libraries. pandas, NumPy and the backtester itself change rounding, resampling and fill rules between releases.
  • Randomness. Any random slippage, spread or tick path that is not seeded gives a different result every run.

What to keep for each result

KeepHow
DataThe file itself, or its SHA-256 and where it is archived
CodeGit commit hash, with a clean working tree
SettingsThe full settings dictionary, seed included, as JSON
VersionsEngine, Python and library versions (pip freeze)
ResultThe result file and its hash

A result with all five can be rerun by anyone with the files. One without them can only be trusted.

How Reamer Research handles it

Reamer Research is deterministic: the same bars, settings and rng_seed give the same result, fill for fill, on every run. The result JSON records its own abi_version and schema_version. This script keeps a run's record beside it and checks a rerun against it:

import hashlib, json, subprocess
import reamer_research as rr

def sha(path):
    return hashlib.sha256(open(path, 'rb').read()).hexdigest()

def run_hash(result):
    return hashlib.sha256(json.dumps(result.json(), sort_keys=True).encode()).hexdigest()

class Breakout:
    def __init__(self, n=20, qty=10):
        self.n, self.qty, self.lookback = n, qty, n + 1
    def on_bar(self, d):
        if d.close[0] == 0:
            return None
        if d.position() == 0 and d.close[-1] > d.high[:-1].max():
            return rr.buy_market(self.qty, stop_loss=d.low[:-1].min())
        if d.position() > 0 and d.close[-1] < d.close[-5:].mean():
            return rr.close_position()

DATA = 'data/SPY_5min.bin'
settings = dict(spread=0.01, slippage=0.005, price_volatility=0.1, rng_seed=42)
result = rr.backtest(Breakout(n=20), DATA, **settings)
record = {'data_sha256': sha(DATA), 'strategy': {'n': 20, 'qty': 10},
          'settings': settings, 'engine': rr.__version__,
          'commit': subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True,
                                   text=True).stdout.strip(),
          'result_sha256': run_hash(result)}
json.dump(record, open('breakout.record.json', 'w'), indent=1)

# months later
old = json.load(open('breakout.record.json'))
assert sha(DATA) == old['data_sha256'], 'data file changed'
again = rr.backtest(Breakout(**old['strategy']), DATA, **old['settings'])
print('reproduced' if run_hash(again) == old['result_sha256'] else 'differs')

The settings include price_volatility, which makes the spread random, and the seed that fixes it: change the seed and the hash changes; keep it and the result is identical. The strategy is an object configured with its parameters, so the record holds them too. A plain function or a class with class attributes works the same way, with its parameters kept in code at the commit.

Limits to know

  • Archiving the data is yours. The engine reads the files it is given; a .bin file is a fixed snapshot, so keep the one each result ran on.
  • Keep the kit release with the record. rr.__version__ names it, and a later release can change fills where its changelog says so, so rerun an old record on the release it names.
  • Evaluation Mode runs 30 days or 50,000 bars of one ticker. Enough to set up the record and check a rerun.

A $20 month includes the full kit, so you can keep reproducible records of your own runs and cancel if it does not fit.

Next questions

What makes a backtest deterministic, and why does it matter?A backtest is deterministic when the same strategy, data, settings and seed give the same output, byte for byte, on every run. That requires fixed randomness, a guaranteed order of events, and nothing that depends on the clock, the machine or a previous run. It matters because every comparison depends on it: when the tool adds no variation of its own, any difference between two results comes from something you changed, and you can check what.Why do AI-written backtests give misleading results?AI assistants write backtests that run but often trade on the signal bar, leave out costs, fit values on the whole history, or test today's survivors. The code looks right and the numbers look great. Check the fill timing, the costs and the data the same way you would check a person's code, or run the strategy on an engine that enforces the timing for you.How do I backtest a trading strategy step by step?Write the rule down precisely, get clean data for the instruments and period, set realistic costs, run it, then read both the report and the individual trades. Choose parameters on one part of the history, check them on another, and paper trade before risking money. Each step catches a different way a backtest can mislead.How do I read a backtest report? Sharpe, Sortino, drawdown and profit factor explainedStart with the trade count and costs, then risk-adjusted return (Sharpe and Sortino), then the worst loss from a peak (maximum drawdown), then how wins compare with losses (profit factor and win rate). No single metric is enough; a strategy is only as good as its weakest honest figure.

Every answer here restates the documents that ship in the kit, which are authoritative. All questions.

Reamer Research

Your first backtest in a minute

Backtesting and live trading in Python and C++. Free to install in Evaluation Mode, with no key or sign-up.

pip install reamer-research

A licence at $20 a month removes every limit. The same code runs unchanged.

Reamer Server

The order-management core for your firm

Your venues, your risk rules on every order, one strategy per CPU core, on your own Linux servers.

$24,000 / year

Or start with a 30-day trial at $2,000.