Technical analysis library for Rust.
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.
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.
Indicators typically implement the following traits:
Next<T>
(oftenNext<f64>
) - to feed and get the next valueReset
- to reset an indicatorDebug
Display
Default
Clone
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)
- greyblake Potapov Sergey - original creator of ta-rs.
- austin-starks Austin Starks – the creator of this repo