Reamer Research
Reamer Research is a Python and C++ backtesting and live trading engine for strategies on bars of any type. You write on_bar in plain Python with numpy, the compiled engine fills its orders under a public execution specification, and the visual trade diagnostics tool charts every closed trade on its bars, with the values you printed beside it.
- Fast compiled engine, prebuilt inside this package: nothing to compile.
- Fills you can read: a seeded tick path inside each bar, with slippage, spread, commission, margin, overnight swap and futures rolls. A fixed
rng_seedgives the same result byte for byte. - Visual trade diagnostics:
open_viewer=Trueopens the run in your browser, one chart per trade, with your printed indicator values, console lines and a Monte Carlo simulation. - Orders a real venue takes: market, limit and stop orders, take-profit and stop-loss brackets, partial closes, IOC and GTD, modify and cancel.
- Many tickers on one wall clock, so rows never need to line up, and memory-mapped
.binfiles for data larger than RAM. - Live trading:
rr.Relaysends the same orders a backtest returns to your own broker connection.
Install
pip install reamer-research # numpy is the only dependency
pip install "reamer-research[pandas]" # to pass DataFrames and get trades as one
Linux x86_64 (glibc 2.35 or later, such as Ubuntu 22.04+), macOS on Apple Silicon (11 or later), and Windows through WSL2. Python 3.9 or later.
A first backtest
curl -LO https://raw.githubusercontent.com/reamerlabs/reamer-research-examples/main/python/sample_data/AAPL.csv
import numpy as np
import reamer_research as rr
def on_bar(d):
c, h, l = d.close, d.high[1:], d.low[1:]
if c[0] == 0: return # warm-up: the window is still filling
atr = (np.maximum(h, c[:-1]) - np.minimum(l, c[:-1])).mean()
mid, px = c.mean(), c[-1]
if d.position() == 0 and px < mid - 2 * atr:
return rr.buy_market(10, take_profit=mid, stop_loss=px - 2 * atr)
if d.position() == 0 and px > mid + 2 * atr:
return rr.sell_market(10, take_profit=mid, stop_loss=px + 2 * atr)
print(rr.backtest(on_bar, 'AAPL.csv', lookback=20, open_viewer=True))
That is an ATR band reversion: it fades a close more than two ATRs from its 20-bar mean, with a bracket that targets the mean. It prints the summary and opens the run in the visual trade diagnostics tool. AAPL.csv is synthetic sample data; any CSV of bars with a header row works, and rr.backtest also takes pandas DataFrames, numpy arrays and .bin files.
Function, class or object
rr.backtest(on_bar, 'AAPL.csv', lookback=20) # a function on_bar(data)
rr.backtest(AtrBands, 'AAPL.csv') # a class with on_bar, instantiated once
rr.backtest(AtrBands(k=2.5), 'AAPL.csv') # an object with on_bar, configured by you
class AtrBands:
lookback = 20 # bars per window
def __init__(self, k=2.0, qty=10):
self.k, self.qty = k, qty # settings
self.entries = 0 # state kept across bars
def on_bar(self, d):
c, h, l = d.close, d.high[1:], d.low[1:]
if c[0] == 0: return
atr = (np.maximum(h, c[:-1]) - np.minimum(l, c[:-1])).mean()
mid, px, band = c.mean(), c[-1], self.k * atr
if d.position() == 0 and px < mid - band:
self.entries += 1
return rr.buy_market(self.qty, take_profit=mid, stop_loss=px - band)
if d.position() == 0 and px > mid + band:
self.entries += 1
return rr.sell_market(self.qty, take_profit=mid, stop_loss=px + band)
Costs and results
result = rr.backtest(AtrBands, 'AAPL.csv', commission_per_unit=0.005, spread=0.01, slippage=0.01)
result.net_pnl, result.sharpe_ratio, result.equity_drawdown_relative
result.trades_frame() # every round trip as a DataFrame (the pandas extra)
result.monte_carlo(simulations=10000) # resampled per-trade returns
result.write_json('run.json') # every fill, the order log, the equity curve
Evaluation Mode and licences
This package runs in Evaluation Mode with no key or sign-up: one ticker per backtest, up to 30 days of bar time or 50,000 bars, and no live trading. A run past a limit raises rr.EvaluationLimit, naming the limit. A Reamer Research licence is $20 a month and removes every limit; you activate it once per machine with reamer-license from the full kit, and the same code runs unchanged.
The full kit adds the C++ wrapper, the C ABI, market-data fetchers for Alpaca and Databento, a paper broker and relay receiver for going live, strategy templates and the reference documents.
Links
- Documentation: Python quickstart, execution specification, going live
- Example strategies and data scripts, MIT License
- Pricing and the full kit
- Questions and bug reports
Reamer Research is proprietary software by Reamer Labs, under the licence in this package's .dist-info/licenses/LICENSE.txt. The Python package source inside it is Wrapper Code you may read, change and keep in your own tree (Section 4).
Metadata
Release files for reamer-research 4.11.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reamer_research-4.11.5-py3-none-manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64 | Details for reamer_research-4.11.5-py3-none-manylinux_2_35_x86_64.whl |
| reamer_research-4.11.5-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for reamer_research-4.11.5-py3-none-macosx_11_0_arm64.whl |
Total release size: 885.6 kB
Release files / reamer_research-4.11.5-py3-none-manylinux_2_35_x86_64.whl
| Download URL | reamer_research-4.11.5-py3-none-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 519.0 kB |
| Tags | Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
c3d42232ba6fd241170b41a588feadeb24ddaf5e781cb7c9e7baf325b704f466
|
|
BLAKE2b-256 checksum How to use checksums |
bd4b46483c248a4b20277744b02999ba6c8b0f9d487fc48e68f6812c879210e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / reamer_research-4.11.5-py3-none-macosx_11_0_arm64.whl
| Download URL | reamer_research-4.11.5-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 366.6 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6a5b66731b06ba30c5a7dcff13c21b06f70c2f38f81212daf61b9e97ad0681f8
|
|
BLAKE2b-256 checksum How to use checksums |
f9aa8495bc1193731cf33f335885f18260ab90f019bebd8e6000e4fe7a76802d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for reamer-research 4.11.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.