YaTa implements most common technical analysis methods and indicators.
It also provides you an interface to create your own indicators.
And many others. See all
And many others. See all
``` use yata::prelude::*; use yata::methods::EMA;
// EMA of length=3 let mut ema = EMA::new(3, 3.0);
ema.next(3.0); ema.next(6.0);
asserteq!(ema.next(9.0), 6.75); asserteq!(ema.next(12.0), 9.375); ```
``` use yata::helpers::{RandomCandles, RegularMethods}; use yata::indicators::MACD; use yata::prelude::*;
let mut candles = RandomCandles::new(); let mut macd = MACD::default(); macd.period3 = 4; // setting signal period MA to 4
macd.method1 = "sma".into(); // one way of defining methods inside indicators
macd.method3 = RegularMethods::TEMA; // another way of defining methods inside indicators
let mut macd = macd.init(candles.first());
for candle in candles.take(10) { let result = macd.next(candle);
println!("{:?}", result);
} ```
Currently there is no unsafe
code in the crate.
You are welcome to give any suggestions about implementing new indicators and methods.
If you like this library and you want to say thanks, you can do it also by donating to bitcoin address 1P3gTnaTK9LKSYx2nETrKe2zjP4HMkdhvK