1 unstable release
0.1.0 | Feb 27, 2021 |
---|
#1255 in Math
145KB
4K
SLoC
ux-indicators
Actively WIP
pub struct FlowMeta<'a> {
pub name: &'a str,
pub tag: u8,
pub visible: bool
}
pub struct DataFrame<M, D>
where
M: fmt::Display,
{
// metric contain something like a timestamp, or month names
pub metric: M,
// data key is tag for stream meta (a.k.a column tag)
// D is
pub data: HashMap<u8, D>,
}
lib.rs
:
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 core::indicators::ExponentialMovingAverage;
use core::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.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
- Trend
- Oscillators
- Other
Dependencies
~5–11MB
~145K SLoC