Skip to main content

Intraday and options backtesting primitives with opening-range profile support.

Project description

CuteMarkets options research illustration

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_KEY
  • ALPACA_API_KEY
  • ALPACA_SECRET_KEY

Package-local paths use:

  • CUTEBACKTESTS_DATA_DIR
  • CUTEBACKTESTS_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cutebacktests-0.2.0.tar.gz (283.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cutebacktests-0.2.0-py3-none-any.whl (295.9 kB view details)

Uploaded Python 3

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

Hashes for cutebacktests-0.2.0.tar.gz
Algorithm Hash digest
SHA256 446cd207990f681eb1fc7683d12c6c2fd04c2278f45730eab4ff7b7fbdabfecd
MD5 6978a87ab4e6235696a748cd1d9d721c
BLAKE2b-256 a717f1127d1f456d49b57ab69d6a6790e4fabf490700fb0536d45f7eef6a8503

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutebacktests-0.2.0.tar.gz:

Publisher: release.yml on cutemarkets/cutebacktests

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for cutebacktests-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2b25035c19db567705fbc5aa4469530a666978d066e44f4c66249e603120bd1
MD5 0f7d9ea0b08eba146ecf27318fe9f9af
BLAKE2b-256 160a661dc0412395fbaea5e8f596cf4db0337f5f70c7aa0cc450884038aaab68

See more details on using hashes here.

Provenance

The following attestation bundles were made for cutebacktests-0.2.0-py3-none-any.whl:

Publisher: release.yml on cutemarkets/cutebacktests

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page