[][src]Crate cxmr_ta_core

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::{Calculate, Next};

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

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

List of indicators

Modules

errors
indicators

Structs

DataItem

Data item is used as an input for indicators.

Traits

Calculate
Close

Close price of a particular period.

High

Highest price of a particular period.

Low

Lowest price of a particular period.

Next

Consumes a data item of type T and returns Output.

Open

Open price of a particular period.

Reset

Resets an indicator to the initial state.

Volume

Trading volume of a particular trading period.