Intraday and options backtesting primitives with opening-range profile support.
Project description
cutebacktests
Intraday options backtesting for U.S. equities.
cutebacktests is the public backtesting runtime behind CuteMarkets research: a DuckDB-backed engine, named opening-range profiles, and market-data adapters for reproducible strategy work on your own machine. It keeps the research stack public and usable without shipping the private orchestration and deployment code from the internal repo.
Scope
- Intraday/options backtesting runtime
- Opening-range profile registry and profile helpers
- CuteMarkets/Alpaca-backed market-data adapters used by the runtime
- Walk-forward robustness helpers
This repository does not ship the congressional-disclosure engine, live/paper bots, remote server launch tooling, or phase orchestration from the private repo.
Install
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
Configure
cp .env.example .env
Required credentials depend on the commands you run:
CUTEMARKETS_API_KEYALPACA_API_KEYALPACA_SECRET_KEY
Package-local paths use:
CUTEBACKTESTS_DATA_DIRCUTEBACKTESTS_DB_PATH
Example
from datetime import datetime
from cutebacktests import (
IntradayOptionsBacktestConfig,
IntradayOptionsBacktester,
get_opening_range_profile,
)
from cutebacktests.providers import CuteMarketsProvider
from cutebacktests.settings import Settings
from cutebacktests.storage import DataStore
settings = Settings.from_env(".env")
store = DataStore(settings.db_path)
profile = get_opening_range_profile("c4_long_only_rr15")
try:
backtester = IntradayOptionsBacktester(
store=store,
cutemarkets_provider=CuteMarketsProvider(settings),
)
result = backtester.run(
IntradayOptionsBacktestConfig(
ticker="SPY",
start=datetime(2025, 1, 1),
end=datetime(2025, 1, 31),
return_trade_log=True,
**profile.to_intraday_strategy_kwargs(),
)
)
print("trades:", result["trades"])
finally:
store.close()
If you want mixed-provider market-data surfaces, pass alpaca_data_provider=AlpacaDataProvider(settings) when you build the backtester.
CLI
Show the public CLI:
python -m cutebacktests.cli --help
Run the intraday/options backtester directly:
python -m cutebacktests.cli run-intraday-options-backtest \
--ticker SPY \
--start 2025-01-01 \
--end 2025-12-31
Run a named opening-range profile:
python -m cutebacktests.cli run-opening-range-profile-backtest \
--profile-name c4_long_only_rr15 \
--ticker SPY \
--start 2025-01-01 \
--end 2025-12-31
Tests
PYTHONPATH=src python -m pytest tests/test_public_surface.py -q
Documentation
- CuteMarkets Docs: cutemarkets.com/docs/
- Repository: github.com/cutemarkets/cutebacktests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cutebacktests-0.2.0.tar.gz.
File metadata
- Download URL: cutebacktests-0.2.0.tar.gz
- Upload date:
- Size: 283.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
446cd207990f681eb1fc7683d12c6c2fd04c2278f45730eab4ff7b7fbdabfecd
|
|
| MD5 |
6978a87ab4e6235696a748cd1d9d721c
|
|
| BLAKE2b-256 |
a717f1127d1f456d49b57ab69d6a6790e4fabf490700fb0536d45f7eef6a8503
|
Provenance
The following attestation bundles were made for cutebacktests-0.2.0.tar.gz:
Publisher:
release.yml on cutemarkets/cutebacktests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cutebacktests-0.2.0.tar.gz -
Subject digest:
446cd207990f681eb1fc7683d12c6c2fd04c2278f45730eab4ff7b7fbdabfecd - Sigstore transparency entry: 1342966917
- Sigstore integration time:
-
Permalink:
cutemarkets/cutebacktests@c225f712ca20adff27e50cb4c96b97b969cff5ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/cutemarkets
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c225f712ca20adff27e50cb4c96b97b969cff5ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file cutebacktests-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cutebacktests-0.2.0-py3-none-any.whl
- Upload date:
- Size: 295.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2b25035c19db567705fbc5aa4469530a666978d066e44f4c66249e603120bd1
|
|
| MD5 |
0f7d9ea0b08eba146ecf27318fe9f9af
|
|
| BLAKE2b-256 |
160a661dc0412395fbaea5e8f596cf4db0337f5f70c7aa0cc450884038aaab68
|
Provenance
The following attestation bundles were made for cutebacktests-0.2.0-py3-none-any.whl:
Publisher:
release.yml on cutemarkets/cutebacktests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cutebacktests-0.2.0-py3-none-any.whl -
Subject digest:
d2b25035c19db567705fbc5aa4469530a666978d066e44f4c66249e603120bd1 - Sigstore transparency entry: 1342966959
- Sigstore integration time:
-
Permalink:
cutemarkets/cutebacktests@c225f712ca20adff27e50cb4c96b97b969cff5ef -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/cutemarkets
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c225f712ca20adff27e50cb4c96b97b969cff5ef -
Trigger Event:
push
-
Statement type: