yata/core/
mod.rs

1// #![warn(missing_docs)]
2#![warn(missing_debug_implementations)]
3//! Some useful features and definitions
4
5mod action;
6mod candles;
7mod errors;
8mod indicator;
9mod method;
10mod moving_average;
11mod ohlcv;
12mod sequence;
13mod window;
14
15pub use action::Action;
16pub use candles::*;
17pub use errors::Error;
18pub use indicator::*;
19pub use method::Method;
20pub use moving_average::*;
21pub use ohlcv::OHLCV;
22pub use sequence::*;
23pub use window::Window;
24
25/// Main value type for calculations
26///
27/// Default is `f64`
28///
29/// If you want use `f32` which is (may be) faster, you can use `cargo build --features value_type_f32`
30///
31/// Or in your `cargo.toml`:
32///
33/// ```toml
34/// [dependencies]
35/// yata = { features = [ "value_type_f32" ] }
36/// ```
37///
38/// Read more at [Features section](https://doc.rust-lang.org/cargo/reference/features.html#the-features-section)
39///
40/// # See also
41///
42/// [`PeriodType`]
43#[cfg(not(feature = "value_type_f32"))]
44pub type ValueType = f64;
45#[cfg(feature = "value_type_f32")]
46#[allow(missing_docs)]
47pub type ValueType = f32;
48
49/// `PeriodType` is a type for using on methods and indicators params.
50///
51/// For default it is `u8` (from `0` to `255`). That means you can use up to `SMA::new(254)`, `WMA::new(254)`, etc...
52/// That's right, there are not `255`, but `254` (`u8::MAX` - 1)
53///
54/// If you want use larger periods, you can switch it by using crate features: `period_type_u16`, `period_type_u32`, `period_type_u64`.
55///
56/// F.e. `cargo build --features period_type_u16`
57///
58/// or in your `cargo.toml`:
59///
60/// ```toml
61/// [dependencies]
62/// yata = { features = ["period_type_u16"] }
63/// ```
64///
65/// Read more at [Features section](https://doc.rust-lang.org/cargo/reference/features.html#the-features-section)
66///
67/// # See also
68///
69/// [`ValueType`]
70#[cfg(not(any(
71	feature = "period_type_u16",
72	feature = "period_type_u32",
73	feature = "period_type_u64"
74)))]
75pub type PeriodType = u8;
76#[cfg(all(
77	feature = "period_type_u16",
78	not(any(feature = "period_type_u32", feature = "period_type_u64"))
79))]
80#[allow(missing_docs)]
81pub type PeriodType = u16;
82#[cfg(all(feature = "period_type_u32", not(feature = "period_type_u64")))]
83#[allow(missing_docs)]
84pub type PeriodType = u32;
85#[cfg(feature = "period_type_u64")]
86#[allow(missing_docs)]
87pub type PeriodType = u64;