JRR Technical - rapmd73/JackrabbitRelay GitHub Wiki

Jackrabbit Relay Technical Analysis Library

Overview

The Jackrabbit Relay Technical Analysis (JRR TA) library is a powerful tool designed for traders and developers looking to perform technical analysis on financial markets. This Python library provides a comprehensive set of features for analyzing price movements, calculating various indicators, and managing historical data. With its user-friendly interface and extensive functionality, JRR TA simplifies the process of implementing technical strategies in trading applications.

Features

Core Functionality

At its core, the JRR TA library allows users to connect to different exchanges and retrieve market data efficiently. It supports multiple assets and timeframes, enabling traders to analyze historical price movements alongside real-time data. The library implements a rolling window mechanism that maintains a fixed-size dataset for analysis, ensuring that users can focus on the most relevant information without being overwhelmed by excessive historical data.

Technical Indicators

The library includes an extensive collection of built-in technical indicators commonly used in trading strategies. These include:

  • Moving Averages: Simple Moving Average (SMA), Exponential Moving Average (EMA), Weighted Moving Average (WMA), Hull Moving Average (HMA), Jurik Moving Average (JMA).
  • Momentum Indicators: Rate of Change (ROC), Momentum.
  • Volatility Indicators: Average True Range (ATR), Bollinger Bands.
  • Trend Indicators: ADX, MACD.
  • Oscillators: RSI, Stochastic Oscillator.
  • Candlestick Patterns: Various patterns such as Doji, Hammer, Engulfing patterns are also supported.

These indicators can be easily integrated into trading algorithms to help identify potential buy or sell signals based on market conditions.

Data Management

One of the standout features of the JRR TA library is its ability to manage OHLCV (Open, High, Low, Close, Volume) data effectively. Users can read OHLCV data from files or fetch it directly from exchanges using the Jackrabbit Relay API. The rolling window approach ensures that only relevant recent data is maintained while older entries are discarded automatically.

Customization

The JRR TA library offers flexibility through customizable parameters for each indicator calculation. Traders can adjust settings such as periods and thresholds according to their specific strategies or preferences. This adaptability makes it suitable for both novice traders looking for straightforward implementations and experienced developers seeking advanced analytical capabilities.


Usage

Here’s a simple example:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
sys.path.append('/home/GitHub/JackrabbitRelay/Base/Library')
import os
import math
import json
import datetime
import time

import JackrabbitRelay as JRR
import JRRtechnical as jrTA

def main():
    ta=jrTA.TechnicalAnalysis('kraken','MAIN','ADA/USD','1m',197)
    ohlcv=ta.ReadOHLCV('ADAUSD.txt')

    SlowLength=197

    Opening=1
    HighIDX=2
    LowIDX=3
    Closing=4
    Volume=5

    for slice in ohlcv:
        ta.Rolling(slice)

        # Create an EMA, column 6
        emaIDX=6
        ta.EMA(Closing,SlowLength)

        # Create a Bollingers Band using a previous EMA, upper boundary will be
        # column 7, lower boundary will be collumn 8

        bbU=7
        bbL=8
        ta.BollingerBands(emaIDX,20,7)

        ta.Display(-1)

if __name__=='__main__':
    main()

From here you can utilize various methods provided by this class to perform analyses like retrieving OHLCV data or calculating indicators like SMA or RSI.

The Jackrabbit Relay Technical Analysis Library is an essential resource for anyone involved in quantitative trading or algorithmic strategy development within financial markets. Its robust architecture combined with an array of technical tools empowers users to make informed decisions based on comprehensive market analyses while maintaining ease-of-use through its intuitive design principles. Whether you are developing new trading algorithms or enhancing existing ones with reliable analytical capabilities—this library serves as a valuable addition to your toolkit in navigating complex market dynamics effectively.


Understanding the Rolling Window (Matrix)

The rolling window, also called the matrix, is the structural foundation of the entire analysis system. It acts as a living record of market behavior, continuously updating and evolving as new price data arrives.

1. What the Rolling Window Is

The rolling window is a list of lists — each row represents a single moment in market time (for example, one candlestick of OHLCV data: open, high, low, close, volume).

Every time new market information is received, it is appended to this matrix. Older data gradually moves out of view, leaving only the most recent observations.

In essence, this creates a sliding frame of reference over the market, always showing the latest “X” periods of data (such as the last 5000 candles).

It’s not a static dataset — it’s dynamic, self-updating, and designed to reflect the most current state of the market without losing short-term context.

2. Why It Matters

Traditional indicators like Moving Averages or RSI rely on discrete series of prices stored elsewhere or recalculated each time.

By contrast, the rolling window keeps all calculations transparent and in sync. Each indicator adds its own column to the same shared structure. This means:

  • Every transformation is visible. Nothing is hidden inside a function or overwritten in memory.

    You can inspect each step of computation — from raw OHLCV data to intermediate averages and final indicator outputs.

  • Historical continuity is preserved. Each new row adds to the story; no indicator acts in isolation.

  • Indicators are interdependent. Because all values share the same row alignment, one indicator can reference another directly (for instance, using SMA output as input for MACD), producing compound, layered analytics without opaque recalculations.

3. Transparency vs. Traditional Indicators

Most charting platforms calculate indicators in memory, hiding intermediary data and logic.

The matrix approach exposes the entire analytical process, line by line:

Timestamp Open High Low Close Volume SMA EMA RSI ADX
12:00:00 1.23 1.25 1.22 1.24 2000 1.22 1.23 54 23
12:01:00 1.24 1.27 1.23 1.26 2300 1.23 1.24 56 25

Every cell can be traced back to its source and method of computation.

This level of transparency allows complete auditability of the trading logic — you can see how and why each number was produced.

4. Benefits of the Rolling Matrix

  • Unified Data Environment: All indicators, statistics, and price series exist within one coherent table.

  • Cumulative Learning: The system doesn’t recalculate everything from scratch; it builds intelligence over time.

  • Error Detection: Since all rows are human-readable, anomalies or data feed errors are immediately visible.

  • Research Transparency: It provides an empirical framework for testing and understanding the actual formation of trading signals.

5. Conceptual Summary

The rolling window is not just a data structure; it is the core instrument of market transparency.

It turns the hidden machinery of technical analysis into something that can be observed, measured, and verified.

Every indicator built on top of it — from SMA to Ichimoku — inherits this openness, allowing the trader or researcher to see, in clear detail, the evolution of each computed value as the market unfolds in real time.


Class: TechnicalAnalysis

This wiki page provides a detailed an alysis of the TechnicalAnalysis class from the Technical-Analysis.py script, a powerful tool designed for financial market analysis. This script is part of the Jackrabbit Relay project, an API endpoint for cryptocurrency and forex exchanges.

Disclaimer: The code is not multiprocessing or thread-safe.

The TechnicalAnalysis class provides a comprehensive suite of tools for technical analysis of financial market data. It interfaces with the Jackrabbit Relay to fetch market data and applies a wide range of technical indicators and candlestick pattern recognition algorithms.

Initialization

The class is initialized with the following parameters:

Parameter Type Description
exchange str The name of the exchange to connect to.
account str The account name on the exchange.
asset str The asset to be analyzed (e.g., 'BTC/USD').
timeframe str The timeframe for the OHLCV data (e.g., '1h', '4h', '1d').
count int The number of historical candles to fetch. The default is 5000.
length int The padding for display purposes. The default is 16.
precision int The numerical precision for display. The default is 8.

Library Functions

A full and complete list of functions is available here.