Crate ta

Source
Expand description

ta is a Rust library for technical analysis. It provides number of technical indicators that can be used to build trading strategies for stock markets, futures, forex, cryptocurrencies, etc.

Every indicator is implemented as a data structure with fields, that define parameters and state.

Every indicator implements Next and Reset traits, which are the core concept of the library.

Since Next<T> is a generic trait, most of the indicators can work with both input types: f64 and more complex structures like DataItem.

§Example

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

// it can return an error, when an invalid period is passed (e.g. 0)
let mut ema = ExponentialMovingAverage::new(3).unwrap();

assert_eq!(ema.next(2.0), 2.0);
assert_eq!(ema.next(5.0), 3.5);
assert_eq!(ema.next(1.0), 2.25);
assert_eq!(ema.next(6.25), 4.25);

§List of indicators

Modules§

Structs§

  • Data item is used as an input for indicators.

Traits§

  • Close price of a particular period.
  • Highest price of a particular period.
  • Lowest price of a particular period.
  • Consumes a data item of type T and returns Output.
  • Open price of a particular period.
  • Return the period used by the indicator.
  • Resets an indicator to the initial state.
  • Trading volume of a particular trading period.