extern crate csv; extern crate core; use ux_indicators::{ indicators::ExponentialMovingAverage as Ema, DataItem, Next }; fn main() { let mut ema = Ema::new(9).unwrap(); let mut reader = csv::Reader::from_path("./examples/data/AMZN.csv").unwrap(); for record in reader.deserialize() { let (date, open, high, low, close, volume): (String, f64, f64, f64, f64, f64) = record.unwrap(); let dt = DataItem::builder() .open(open) .high(high) .low(low) .close(close) .volume(volume) .build() .unwrap(); let ema_val = ema.next(&dt); println!("{}: {} = {:2.2}", date, ema, ema_val); } }