Skip to main content

Low Latency incremental Technical Analysis

Project description

RTTA

Purpose

The purpose of this package is to implement a very low latency incremental technical analysis toolkit. Most technical analysis tool-kits work in a "batch mode" where you hand them a blob of data and in a pandas series and they return a series with the computed data. Incremental updates for these require O(n) work. There is one tool, talipp that is designed to support incremental updates, but it is implemented in pure python and is a little more than an order of magnitude slower than rtta. On a 5995WX talipp's exponential moving average requires 465ns; rtta's requires 36ns. A bare python function call requires 35ns, so we're about as fast as fast can be.

Installation

pip install rtta

Usage

Each operator has a paramater fillna. If set to false, nan values will be returned until the operation is "populated". If set to true, best guesses will be returned until the operation is populated.

So for example, our simple moving average SMAIndicator works sort of like this:

>>> import rtta.trend as trend
>>> sma = trend.SMAIndicator(window=4, fillna=True)
>>> sma.update(1)
1
>>> sma.update(2)
1.5
>>> sma.update(3)
2
>>> sma.update(2)
2
>>> sma.update(2)
2.25 <- The 1 fell off the end of the sliding window

Performance

Indicator Latency
SMA 36ns
EMA 36ns
MACD 55ns

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

rtta-0.0.12.tar.gz (311.3 kB view hashes)

Uploaded Source

Built Distribution

rtta-0.0.12-cp311-cp311-macosx_12_0_x86_64.whl (246.6 kB view hashes)

Uploaded CPython 3.11 macOS 12.0+ x86-64

Supported by

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