rust_ti 0.0.2

Rust TI, the most configurable Technical Indicators package available
Documentation

RustTI

A Technical Indicators library for Rust

What differentiates RustTI from other Technical Indicator packages is how configurable the functions are.

Many models were created decades ago when the work weeks were different (such as RSI, SO, Ichimoku cloud...) and the observations were made daily. For example, if one decides to study stocks the work week is 5 days, but if one studies cryptocurrencies the work week is 7 days.

RustTI allows the caller to determine their own period based on the market being studied. Everything is configurable in the RustTI functions, from period to moving average models.

A lot of online articles recommend sticking with the TI defaults as these are used by traders. I would recommend the opposite. While it is true that most day traders tend to stick to the defaults, large financial institutions such as investment banks and hedge funds have their own quantitative teams who build them custom models. This is what this package allows you to do.

Many of the functions accept parameters that allow the caller to move the technial indicators away from its default behaviour. For example, if a TI uses the mean to calculate the indicator, it can be told to use the median, or mode instead.

For this reason, RustTI is a more advanced Technical Inidcators package, and the users should have some base knowledge of the indicators they plan on using.

RustTI is split into different modules, organised by common TI areas. Each module is then split into a single and a bulk submodule.

The single submodule is used to calculate the indicator once, using the entire price slice that is passed in.

The bulk submodule is used to iterate over a slice of prices to calculate the indicator for a period.

Many of the functions accept parameters that will allow the caller to move away from the technial indicators from its default behaviour. For example, if a function normally uses the mean to calculate the indicator, it can be told to use the median, or mode instead. More information is given in the functions that allow this.

Documentation

Documentation can be found on DOCS.RS rust_ti

S&P 500 Example

An example using the Rust TI for the S&P 500 can be found in examples/main.rs

The code in examples/main.rs can be run by cloning this repo, then running the following commands:

cargo build
cargo run --example sp500

Available indicators:

Basic Indicators

basic_indicators are basic functions that are often the foundation of more complex indicators.

Bulk

  • absolute_deviation - Calculates the absolute deviation
  • log - Calculates the natural logrithm of slice of prices
  • log_difference - Calculates the difference between the natural logarithm at t and t-1
  • mean - Calculates the mean (average) of a slice of prices
  • median - Calculates the median (middle value) of a slice of prices
  • mode - Calculates the mode (most common price) of a slice of prices
  • standard_deviation - Calculates the standard deviation of a slice of prices
  • variance - Calculates the variance of slice of prices

Single

  • absolute_deviation - Calculates the absolute deviation
  • log_difference - Calculates the difference between the natural logarithm at t and t-1
  • max - Calculates the maximum of a slice of prices
  • mean - Calculates the mean (average) of a slice of prices
  • median - Calculates the median (middle value) of a slice of prices
  • min - Calculates the minimum of a slice of prices
  • mode - Calculates the mode (most common price) of a slice of prices
  • standard_deviation - Calculates the standard deviation of a slice of prices
  • variance - Calculates the variance of slice of prices

Candle Indicators

candle_indicators are indicators that are used with candle charts.

Bulk

Single

Chart Trends

chart_trends shows trends on charts. Unlike the other modules it has no bulk or single.

Correlation indicators

correlation_indicators show how closely the prices of two different assets move together.

Bulk

Single

Momentum Indicators

momentum_indicators show how much the price is rising or falling

Bulk

Single

Moving Averages

The moving_average module has functions used to calculate the moving average

Bulk

Single

Other Indicators

other_indicators don't really fit in anywhere else

Bulk

Single

Strength Indicators

strength_indicators show the strength of a trend

Bulk

Single

Trend Indicators

trend_indicators show the trend direction of an asset

Bulk

Single

Volatility Indicators

volatility_indicators show how volatile an asset are.

Bulk

Single