Skip to main content

Low latency incremental technical analysis

Project description

RTTA

pyrtta is a low-latency C++23/nanobind library for tick-by-tick technical analysis, online change detection, market regime monitoring, and research signals. The Python import package is rtta.

The design goal is to make accidental crystal-balling hard. Algorithms are stateful, causal objects: callers feed one tick at a time through update(...) or advance(...), and the object can only react to data it has already seen. That surface is meant to fit live systems, interactive research modes, and market simulators where orders must be decided before the next observation is available.

Scope

The current benchmark registry covers 188 algorithms:

  • Classic technical indicators: moving averages, oscillators, trend, volatility, price transforms, bands, channels, volume indicators, and returns.
  • State-space and adaptive filters: Kalman variants, particle filters, interacting multiple models, Gaussian-process and kernel envelopes, and tracking filters.
  • Market microstructure and liquidity widgets: order-flow imbalance, bid-ask bounce, spread features, quote/trade intensity, VPIN, Amihud, Kyle lambda, liquidity drought, spread explosion, and execution-cost/slippage regimes.
  • Online change and drift detection: CUSUM, Page-Hinkley, ADWIN, DDM, EDDM, HDDM, KSWIN, EWMA z-score shifts, residual/error/hit-rate/calibration/feature drift, and rolling two-window mean, variance, correlation, beta, and spread/liquidity shift detectors.
  • Online regime filters: threshold and hysteresis regimes, volatility/ATR/ realized-variance/trend-chop/liquidity/spread/volume/order-flow/correlation/ beta/pairs-spread regimes, bounded BOCPD, online HMM, sticky HMM-style, Markov-switching volatility, Gaussian mixture, and semi-Markov-style filters.
  • Finance-specific live widgets: volatility breakout, compression/expansion, microstructure-noise, quote-stuffing, lead-lag, open/close and auction/continuous-market transitions, cross-asset correlation breaks, and streaming residual-based cointegration breakdown monitoring.

Installation

pip install pyrtta

Usage

import rtta

rsi = rtta.RSI()

for close in close_stream:
    value = rsi.update(close)
    if value > 70.0:
        reduce_position()

Use advance(...) when the caller only needs to update state and does not need a Python result object for that tick:

ema = rtta.EMA(window=30.0)

for close in warmup_ticks:
    ema.advance(close)

current = ema.update(next_close)

Most indicators expose:

  • update(...): consume one sample and return the current value/result.
  • advance(...): consume one sample and return None.
  • last() or last_<field>(): read the most recent state without advancing.
  • batch(...): causal bulk catch-up for restart/research workflows. It consumes input in chronological order and leaves the object ready for the next live tick.
  • replay_update(...), replay_advance(...), and replay_update_outputs(...): C++ replay paths for causal catch-up and latency benchmarking.

Multi-output indicators return immutable C++ result structs with read-only fields. Scalar convenience methods such as update_upper(...) and last_upper() are available where an indicator has named fields.

Benchmarks

Latency results are maintained on the standalone benchmark page. The benchmark page records CPU and runtime metadata for current Intel, Apple Silicon, and Loongson runs.

Development

This project is built as a C++23 nanobind extension with CMake through scikit-build-core.

poetry install --with build,dev --no-root
poetry run python -m pip install --no-build-isolation -e .
poetry run pytest

To build a wheel:

poetry run python -m build --wheel

Citation

If you use RTTA in research, benchmarks, or published work, cite it with:

@misc{deprince2026pyrtta,
  author       = {DePrince, Adam},
  title        = {{pyrtta}: Low Latency Incremental Technical Analysis},
  year         = {2026},
  version      = {0.2.2},
  howpublished = {\url{https://github.com/adamdeprince/rtta}},
  note         = {Python package name: pyrtta; import package name: rtta}
}

The same entry is available in CITATION.bib.

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

pyrtta-0.2.2.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

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

pyrtta-0.2.2-cp312-abi3-manylinux_2_39_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.39+ x86-64

pyrtta-0.2.2-cp312-abi3-manylinux_2_39_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.39+ ARM64

pyrtta-0.2.2-cp312-abi3-macosx_26_0_arm64.whl (854.6 kB view details)

Uploaded CPython 3.12+macOS 26.0+ ARM64

File details

Details for the file pyrtta-0.2.2.tar.gz.

File metadata

  • Download URL: pyrtta-0.2.2.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pyrtta-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d982c8dc9fc014a95ff2bc6ea3291af978036eacf8355b7df980bd9a3c6a1415
MD5 43f3ed5fb5de9c0d7665a516d27ee113
BLAKE2b-256 df1b6205ab2d7607e3d537302d8269897c163c1421ac972080c1053788b4dec0

See more details on using hashes here.

File details

Details for the file pyrtta-0.2.2-cp312-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyrtta-0.2.2-cp312-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 194ab21ccdc40ac10d99c5d700b4ae048b157aeb89f832d3814df18883679317
MD5 56cf0aa421511091ef209ad247ee953e
BLAKE2b-256 05629ae71d0bc16334dd4d67399d50433b3dfb34415938c54e106a6e0f09cd82

See more details on using hashes here.

File details

Details for the file pyrtta-0.2.2-cp312-abi3-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for pyrtta-0.2.2-cp312-abi3-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 f7dfbe35050f4747a297ce32638b8480c2e380d67e7d1ec1a36abd304091c643
MD5 a460fa72753a00b95cf12f1073d00a34
BLAKE2b-256 5d302c84779c27378315e5e760012159a28d1cb3629dfe502349cb9154c0b5ac

See more details on using hashes here.

File details

Details for the file pyrtta-0.2.2-cp312-abi3-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pyrtta-0.2.2-cp312-abi3-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 05e28ce73a3bedd7d70dd9928525d689d48c4f97d953c32aa75f961ff8faba3f
MD5 28c840aa721be3b0a8827e3da6b985db
BLAKE2b-256 4e60d72c784bbefd620caacb941b36ada1deb4cd51872928b7bad82ab3fc204e

See more details on using hashes here.

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