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` module, which represents version 1 of the library.
5
6The indicators implemented in this library include:
7
8- **ATR (Average True Range):** Measures market volatility.
9- **Bollinger Bands:** Uses a simple moving average (SMA) and standard deviation to define upper and lower price bands.
10- **EMA (Exponential Moving Average):** A weighted moving average that gives more importance to recent prices.
11- **MA (Moving Averages):** A unified module that consolidates multiple moving averages (SMA, EMA, MACD).
12- **MACD (Moving Average Convergence Divergence):** Combines fast and slow EMAs with a signal line to provide trend-following signals.
13- **RSI (Relative Strength Index):** An oscillator used to identify overbought and oversold conditions.
14- **SMA (Simple Moving Average):** Calculates the average of the close prices over a given period.
15- **ROC (Rate of Change):** Measures the percentage change between the current and a past price.
16- **Momentum:** Measures the difference between the current price and the price from a specified number of periods ago.
17- **Stochastic Oscillator:** A momentum indicator comparing a particular closing price to a range of its prices over a certain period.
18- **Support & Resistance:** Identifies potential support and resistance levels based on price swings.
19- **Shared Types:** Common structures and enumerations used across multiple indicators.
20
21Each 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.
22
23*/
24
25pub mod v1 {
26    //! # Version 1
27    //!
28    //! This module groups all the technical indicators and shared types under version 1 of the
29    //! `indexes_rs` library. The structure is as follows:
30    //!
31    //! - **atr:** Implements the Average True Range (ATR) indicator.
32    //! - **bollinger:** Implements Bollinger Bands.
33    //! - **ema:** Implements the Exponential Moving Average (EMA) indicator.
34    //! - **ma:** Provides a unified interface for multiple moving averages (SMA, EMA, MACD).
35    //! - **macd:** Implements the MACD (Moving Average Convergence Divergence) indicator.
36    //! - **rsi:** Implements the Relative Strength Index (RSI) indicator.
37    //! - **sma:** Implements the Simple Moving Average (SMA) indicator.
38    //! - **roc:** Implements the Rate of Change (ROC) indicator.
39    //! - **momentum:** Implements the Momentum indicator.
40    //! - **stochastic:** Implements the Stochastic Oscillator indicator.
41    //! - **support_resistance:** Implements Support & Resistance indicators.
42    //! - **types:** Contains shared types (structs, enums) used throughout the library.
43
44    pub mod atr {
45        //! **ATR Module**
46        //!
47        //! Provides an implementation of the Average True Range (ATR) indicator.
48        mod __tests__;
49        pub mod main;
50    }
51    pub mod bollinger {
52        //! **Bollinger Bands Module**
53        //!
54        //! Implements Bollinger Bands using a simple moving average (SMA) and standard deviation.
55        mod __tests__;
56        pub mod main;
57        pub mod types;
58    }
59    pub mod ema {
60        //! **EMA Module**
61        //!
62        //! Implements the Exponential Moving Average (EMA) indicator.
63        mod __tests__;
64        pub mod main;
65    }
66    pub mod ma {
67        //! **Moving Averages Module**
68        //!
69        //! Provides a unified interface for multiple moving averages, including SMA, EMA, and MACD.
70        mod __tests__;
71        pub mod main;
72    }
73    pub mod macd {
74        //! **MACD Module**
75        //!
76        //! Implements the Moving Average Convergence Divergence (MACD) indicator.
77        mod __tests__;
78        pub mod main;
79        pub mod types;
80    }
81    pub mod rsi {
82        //! **RSI Module**
83        //!
84        //! Implements the Relative Strength Index (RSI) indicator.
85        mod __tests__;
86        pub mod main;
87        pub mod types;
88    }
89    pub mod sma {
90        //! **SMA Module**
91        //!
92        //! Implements the Simple Moving Average (SMA) indicator.
93        mod __tests__;
94        pub mod main;
95        pub mod types;
96    }
97    pub mod roc {
98        //! **ROC Module**
99        //!
100        //! Implements the Rate of Change (ROC) indicator.
101        mod __tests__;
102        pub mod main;
103        pub mod types;
104    }
105    pub mod momentum {
106        //! **Momentum Module**
107        //!
108        //! Implements the Momentum indicator.
109        mod __tests__;
110        pub mod main;
111        pub mod types;
112    }
113    pub mod stochastic {
114        //! **Stochastic Oscillator Module**
115        //!
116        //! Implements the Stochastic Oscillator indicator.
117        mod __tests__;
118        pub mod main;
119        pub mod types;
120    }
121    pub mod support_resistance {
122        //! **Support & Resistance Module**
123        //!
124        //! Implements support and resistance indicators based on swing highs and lows.
125        mod _tests__;
126        pub mod main;
127        pub mod types;
128    }
129
130    pub mod types;
131}