Crate rust_ti

source ·
Expand description

§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…). For example, if one studies stocks the work week is 5 days, but if one studies cryptocurrencies the work week is 7 days.

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 part of 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 basic 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.

§Available indicators:

§Standard Indicators

standard_indicators are configurable indicators that have had their configurations hardcoded to follow industry standards.

These are essentially wrappers for the other functions.

§Bulk
§Single

§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 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

Modules§

Enums§

  • The CentralPoint enum is used to determine the central point
  • The ConstantModelType enum is used by a number of functions to determine the centerpoint around which to do its calculations.
  • The DeviationModel enum is used by a number of functions to determine the deviation from a central point.
  • The MovingAverageType is used when calculating the moving_average. The simple caclculates the moving average without interferring, however the smoothed and exponential types assign weights to the more recent prices.
  • The Position enum is used for indicators that need to know the position of the trade (short, long) to perform their calculations.