ta_panther/lib.rs
1//! ta is a Rust library for technical analysis. It provides number of technical indicators
2//! that can be used to build trading strategies for stock markets, futures, forex, cryptocurrencies, etc.
3//!
4//! Every indicator is implemented as a data structure with fields, that define parameters and
5//! state.
6//!
7//! Every indicator implements [Next<T>](trait.Next.html) and [Reset](trait.Reset.html) traits,
8//! which are the core concept of the library.
9//!
10//! Since `Next<T>` is a generic trait, most of the indicators can work with both input types: `f64` and more complex
11//! structures like [DataItem](struct.DataItem.html).
12//!
13//! # Example
14//! ```
15//! use ta_panther::indicators::ExponentialMovingAverage;
16//! use ta_panther::Next;
17//!
18//! // it can return an error, when an invalid period is passed (e.g. 0)
19//! let mut ema = ExponentialMovingAverage::new(3).unwrap();
20//!
21//! assert_eq!(ema.next(2.0), 2.0);
22//! assert_eq!(ema.next(5.0), 3.5);
23//! assert_eq!(ema.next(1.0), 2.25);
24//! assert_eq!(ema.next(6.25), 4.25);
25//! ```
26//!
27//! # List of indicators
28//!
29//! * Trend
30//! * [Exponential Moving Average (EMA)](crate::indicators::ExponentialMovingAverage)
31//! * [Simple Moving Average (SMA)](crate::indicators::SimpleMovingAverage)
32//! * [Weighted Moving Average (WMA)](crate::indicators::WeightedMovingAverage)
33//! * Oscillators
34//! * [Relative Strength Index (RSI)](indicators/struct.RelativeStrengthIndex.html)
35//! * [Fast Stochastic](indicators/struct.FastStochastic.html)
36//! * [Slow Stochastic](indicators/struct.SlowStochastic.html)
37//! * [Moving Average Convergence Divergence (MACD)](indicators/struct.MovingAverageConvergenceDivergence.html)
38//! * [Percentage Price Oscillator (PPO)](indicators/struct.PercentagePriceOscillator.html)
39//! * [Commodity Channel Index (CCI)](indicators/struct.CommodityChannelIndex.html)
40//! * [Money Flow Index (MFI)](indicators/struct.MoneyFlowIndex.html)
41//! * Other
42//! * [Standard Deviation (SD)](indicators/struct.StandardDeviation.html)
43//! * [Mean Absolute Deviation (MAD)](indicators/struct.MeanAbsoluteDeviation.html)
44//! * [Bollinger Bands (BB)](indicators/struct.BollingerBands.html)
45//! * [Chandelier Exit (CE)](indicators/struct.ChandelierExit.html)
46//! * [Keltner Channel (KC)](indicators/struct.KeltnerChannel.html)
47//! * [Maximum](indicators/struct.Maximum.html)
48//! * [Minimum](indicators/struct.Minimum.html)
49//! * [True Range](indicators/struct.TrueRange.html)
50//! * [Average True Range (ATR)](indicators/struct.AverageTrueRange.html)
51//! * [Efficiency Ratio (ER)](indicators/struct.EfficiencyRatio.html)
52//! * [Rate of Change (ROC)](indicators/struct.RateOfChange.html)
53//! * [On Balance Volume (OBV)](indicators/struct.OnBalanceVolume.html)
54//!
55#[cfg(test)]
56#[macro_use]
57mod test_helper;
58
59mod helpers;
60
61pub mod errors;
62pub mod indicators;
63
64mod traits;
65pub use crate::traits::*;
66
67mod data_item;
68pub use crate::data_item::DataItem;