#![feature(test)] // use yata::core::Candle; use yata::helpers::RandomCandles; use yata::indicators::*; use yata::prelude::*; extern crate test; fn bench_indicator(b: &mut test::Bencher) { let candles: Vec<_> = RandomCandles::new().take(1000).collect(); let mut iter = candles.iter().cycle(); let mut indicator = T::default().init(iter.next().unwrap()).unwrap(); for _ in 0..50 { indicator.next(iter.next().unwrap()); } b.iter(|| indicator.next(iter.next().unwrap())) } #[bench] fn bench_indicator_aroon(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_indicator_average_directional_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_awesome_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_bollinger_bands(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_chaikin_money_flow(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_chaikin_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_chande_kroll_stop(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_chande_momentum_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_commodity_channel_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_coppock_curve(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_detrended_price_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_donchian_channel(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_ease_of_movement(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_elders_force_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_envelopes(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_fisher_transform(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_hull_moving_average(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_ichimoku_cloud(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_kaufman(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_keltner_channel(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_klinger_volume_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_know_sure_thing(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_macd(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_momentum_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_money_flow_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_parabolic_sar(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_pivot_reversal_strategy(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_relative_strength_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_relative_vigor_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_smi_ergodic_indicator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_stochastic_oscillator(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_trend_strength_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_trix(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_true_strength_index(b: &mut test::Bencher) { bench_indicator::(b); } #[bench] fn bench_woodies_cci(b: &mut test::Bencher) { bench_indicator::(b); }