indexes_rs/lib.rs
1/*!
2# indexes_rs Library
3
4Welcome to the `indexes_rs` library! This library provides a suite of technical indicators for financial market analysis. All indicators and related types are grouped under the `v1` and `v2` modules.
5
6## Version 1 (v1)
7The original collection of fundamental technical indicators including RSI, MACD, Bollinger Bands, and other essential indicators for technical analysis.
8
9## Version 2 (v2)
10An advanced collection of technical indicators specifically designed for cryptocurrency trading algorithms and sophisticated signal aggregation systems. This version focuses on volume-based indicators, trend strength measurement, and momentum analysis optimized for crypto market volatility.
11
12The v2 indicators implemented in this library include:
13
14- **OBV (On Balance Volume):** Volume-based momentum indicator that tracks cumulative volume flow.
15- **MFI (Money Flow Index):** Volume-weighted RSI that combines price and volume for overbought/oversold analysis.
16- **Parabolic SAR:** Trend-following indicator providing dynamic stop-loss levels and reversal signals.
17- **ADX (Average Directional Index):** Measures trend strength regardless of direction, essential for trend filtering.
18- **CCI (Commodity Channel Index):** Momentum oscillator for identifying cyclical trends and extreme conditions.
19- **Williams %R:** Momentum indicator for detecting extreme overbought/oversold conditions.
20- **Standard Deviation:** Mathematical foundation for volatility measurement and statistical analysis.
21
22Each module contains its own implementation (typically in a `main.rs` file) and associated tests (in a `__tests__.rs` or `_tests__` directory). For more details on each indicator, please refer to the documentation within the corresponding module.
23
24*/
25
26pub mod v1 {
27 //! # Version 1
28 //!
29 //! This module groups all the technical indicators and shared types under version 1 of the
30 //! `indexes_rs` library. The structure is as follows:
31 //!
32 //! - **atr:** Implements the Average True Range (ATR) indicator.
33 //! - **bollinger:** Implements Bollinger Bands.
34 //! - **ema:** Implements the Exponential Moving Average (EMA) indicator.
35 //! - **ma:** Provides a unified interface for multiple moving averages (SMA, EMA, MACD).
36 //! - **macd:** Implements the MACD (Moving Average Convergence Divergence) indicator.
37 //! - **rsi:** Implements the Relative Strength Index (RSI) indicator.
38 //! - **sma:** Implements the Simple Moving Average (SMA) indicator.
39 //! - **roc:** Implements the Rate of Change (ROC) indicator.
40 //! - **momentum:** Implements the Momentum indicator.
41 //! - **stochastic:** Implements the Stochastic Oscillator indicator.
42 //! - **support_resistance:** Implements Support & Resistance indicators.
43 //! - **types:** Contains shared types (structs, enums) used throughout the library.
44
45 pub mod atr {
46 //! **ATR Module**
47 //!
48 //! Provides an implementation of the Average True Range (ATR) indicator.
49 mod __tests__;
50 pub mod main;
51 }
52 pub mod bollinger {
53 //! **Bollinger Bands Module**
54 //!
55 //! Implements Bollinger Bands using a simple moving average (SMA) and standard deviation.
56 mod __tests__;
57 pub mod main;
58 pub mod types;
59 }
60 pub mod ema {
61 //! **EMA Module**
62 //!
63 //! Implements the Exponential Moving Average (EMA) indicator.
64 mod __tests__;
65 pub mod main;
66 }
67 pub mod ma {
68 //! **Moving Averages Module**
69 //!
70 //! Provides a unified interface for multiple moving averages, including SMA, EMA, and MACD.
71 mod __tests__;
72 pub mod main;
73 }
74 pub mod macd {
75 //! **MACD Module**
76 //!
77 //! Implements the Moving Average Convergence Divergence (MACD) indicator.
78 mod __tests__;
79 pub mod main;
80 pub mod types;
81 }
82 pub mod rsi {
83 //! **RSI Module**
84 //!
85 //! Implements the Relative Strength Index (RSI) indicator.
86 mod __tests__;
87 pub mod main;
88 pub mod types;
89 }
90 pub mod sma {
91 //! **SMA Module**
92 //!
93 //! Implements the Simple Moving Average (SMA) indicator.
94 mod __tests__;
95 pub mod main;
96 pub mod types;
97 }
98 pub mod roc {
99 //! **ROC Module**
100 //!
101 //! Implements the Rate of Change (ROC) indicator.
102 mod __tests__;
103 pub mod main;
104 pub mod types;
105 }
106 pub mod momentum {
107 //! **Momentum Module**
108 //!
109 //! Implements the Momentum indicator.
110 mod __tests__;
111 pub mod main;
112 pub mod types;
113 }
114 pub mod stochastic {
115 //! **Stochastic Oscillator Module**
116 //!
117 //! Implements the Stochastic Oscillator indicator.
118 mod __tests__;
119 pub mod main;
120 pub mod types;
121 }
122 pub mod support_resistance {
123 //! **Support & Resistance Module**
124 //!
125 //! Implements support and resistance indicators based on swing highs and lows.
126 mod _tests__;
127 pub mod main;
128 pub mod types;
129 }
130
131 pub mod types;
132}
133
134pub mod v2 {
135 //! # Version 2 - Advanced Crypto Trading Indicators
136 //!
137 //! This module contains advanced technical indicators specifically designed for cryptocurrency
138 //! trading algorithms and sophisticated signal aggregation systems. These indicators focus on
139 //! volume analysis, trend strength measurement, and momentum detection optimized for the high
140 //! volatility environment of cryptocurrency markets.
141 //!
142 //! ## Tier 1 Indicators (Essential)
143 //! - **obv:** On Balance Volume - Critical volume-based momentum indicator
144 //! - **mfi:** Money Flow Index - Volume-weighted RSI for comprehensive market analysis
145 //!
146 //! ## Tier 2 Indicators (Highly Recommended)
147 //! - **parabolic_sar:** Parabolic SAR - Dynamic trend-following with 95% confidence level
148 //! - **adx:** Average Directional Index - Superior trend strength filtering
149 //! - **cci:** Commodity Channel Index - Effective momentum measurement for cyclical analysis
150 //!
151 //! ## Tier 3 Indicators (Supplementary)
152 //! - **williams_r:** Williams %R - Extreme condition detection for overbought/oversold analysis
153 //!
154 //! ## Mathematical Foundation
155 //! - **std_dev:** Standard Deviation - Essential statistical foundation for volatility analysis
156 //!
157 //! All indicators are designed to work together in signal aggregation systems and include
158 //! comprehensive error handling, state management, and batch processing capabilities.
159
160 /// **OBV Module**
161 ///
162 /// On Balance Volume (OBV) is a volume-based momentum indicator that tracks cumulative
163 /// volume flow to predict price movements. Essential for crypto signal validation.
164 pub mod obv {
165 mod __tests__;
166 pub mod main;
167 pub mod types;
168 }
169
170 /// **MFI Module**
171 ///
172 /// Money Flow Index (MFI) combines price and volume data to create a volume-weighted
173 /// version of RSI. Critical for identifying overbought/oversold conditions in crypto markets.
174 pub mod mfi {
175 mod __tests__;
176 pub mod main;
177 pub mod types;
178 }
179
180 /// **Parabolic SAR Module**
181 ///
182 /// Parabolic SAR (Stop and Reverse) provides dynamic trend-following signals and stop-loss
183 /// levels. Achieves 95% confidence level in crypto applications according to analysis.
184 pub mod parabolic_sar {
185 mod __tests__;
186 pub mod main;
187 pub mod types;
188 }
189
190 /// **ADX Module**
191 ///
192 /// Average Directional Index measures trend strength regardless of direction.
193 /// Superior trend strength filtering essential for crypto trading algorithms.
194 pub mod adx {
195 mod __tests__;
196 pub mod main;
197 pub mod types;
198 }
199
200 /// **CCI Module**
201 ///
202 /// Commodity Channel Index is a momentum oscillator that identifies cyclical trends
203 /// and extreme market conditions. Effective for crypto's cyclical price patterns.
204 pub mod cci {
205 mod __tests__;
206 pub mod main;
207 pub mod types;
208 }
209
210 /// **Williams %R Module**
211 ///
212 /// Williams %R is a momentum indicator specialized for detecting extreme overbought
213 /// and oversold conditions. Particularly effective in crypto's volatile environment.
214 pub mod williams_r {
215 mod __tests__;
216 pub mod main;
217 pub mod types;
218 }
219
220 /// **Standard Deviation Module**
221 ///
222 /// Standard Deviation provides the mathematical foundation for volatility measurement
223 /// and statistical analysis. Essential for Bollinger Bands and risk assessment.
224 pub mod std_dev {
225 mod __tests__;
226 pub mod main;
227 pub mod types;
228 }
229
230 /// **ATR(v2) Module**
231 ///
232 /// Provides an implementation of the Average True Range (ATR) indicator with OHLC.
233 pub mod atr {
234 mod __tests__;
235 pub mod main;
236 pub mod types;
237 }
238
239 /// **Stochastic(v2) Oscillator Module**
240 ///
241 /// Implements the Stochastic Oscillator indicator with OHLC.
242 pub mod stochastic {
243 mod __tests__;
244 pub mod main;
245 pub mod types;
246 }
247
248 /// **Support Resistance Module**
249 ///
250 /// Implements a fractal-based Support and Resistance level identifier
251 /// using High and Low price data.
252 pub mod support_resistance {
253 mod __tests__;
254 pub mod main;
255 pub mod types;
256 }
257}