Skip to content

austin-starks/ta-rs-improved

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Technical Analysis for Rust (ta)

Technical analysis library for Rust.

Introduction

This is ta-rs-improved, an improved version of the technical indicator library in Rust. There are two notable changes that makes this application improved.

  • Dynamic Window Sizes. This means you can do a 30 day SMA and a 15 hour SMA.
  • Correct calculation of the Relative Strength Index (RSI)

This library is used to power NexusTrade, an AI-Powered automated investing research platform. NexusTrade allows even non-technical users to perform financial research, create automated strategies, and optimize those strategies with an easy-to-use UI. Users can then deploy their strategies live to the market with the click of a button.

For more information about this repository, read the following article.

NexusTrade – AI-Powered Trading

These indicators are implemented in NexusTrade. NexusTrade is an AI-Powered algorithmic trading platform that lets users create, test, optimize, and deploy automated trading strategies. Try it now for free!

Getting started

Add to you Cargo.toml:

[dependencies]
ta = { git = "https://github.com/austin-starks/ta-rs-improved" }

Example:

use ta::indicators::ExponentialMovingAverage;
use ta::Next;

let mut ema = ExponentialMovingAverage::new(Duration::seconds(3)).unwrap(); // window size of 3 seconds
let now = Utc::now();

assert_eq!(ema.next((now, 2.0)), 2.0);
assert_eq!(ema.next((now + Duration::seconds(1), 5.0)), 3.5);
assert_eq!(ema.next((now + Duration::seconds(2), 1.0)), 2.25);
assert_eq!(ema.next((now + Duration::seconds(3), 6.25)), 4.25);

See more in the examples here. Check also the documentation.

Basic ideas

Indicators typically implement the following traits:

  • Next<T> (often Next<f64>) - to feed and get the next value
  • Reset - to reset an indicator
  • Debug
  • Display
  • Default
  • Clone

List of indicators

So far there are the following indicators available.

  • Trend
    • Exponential Moving Average (EMA)
    • Simple Moving Average (SMA)
  • Oscillators
    • Relative Strength Index (RSI)
  • Other
    • Minimum
    • Maximum
    • Standard Deviation (SD)
    • Mean Absolute Deviation (MAD)
    • Bollinger Bands (BB)
    • Rate of Change (ROC)

Contributors

  • greyblake Potapov Sergey - original creator of ta-rs.
  • austin-starks Austin Starks – the creator of this repo