roc-rs

Crates.ioroc-rs
lib.rsroc-rs
version0.1.0
sourcesrc
created_at2020-11-16 07:29:20.04025
updated_at2020-11-16 07:29:20.04025
descriptionRate Of Change (ROC) Implementation In Rust
homepagehttps://github.com/immortalinfidel/roc-rs
repositoryhttps://github.com/immortalinfidel/roc-rs.git
max_upload_size
id312808
size4,530
sabin chitrakar (sabinchitrakar)

documentation

README

roc-rs

Rate Of Change (ROC) implementation in rust

use roc_rs::ROC;
use ta_common::traits::Indicator;

let mut roc = ROC::new(1, None);
let res = roc.next(100 as f64);
assert_eq!(None, res);
let res = roc.next(50 as f64);
assert_eq!(Some(-50_f32), res);

Calculation

ROCR=(Current Price/Price Prev n Ago);
ROCP=ROCR-1;
ROC100=(ROCR)*100;
ROC=(ROCR-1)*100; //DEFAULT

Commit count: 8

cargo fmt