use crate::data::parser::{Ohlcv, Tick}; pub enum DataRow { Ohlc(Ohlcv), TickData(Tick), } pub struct DataFeed { pub symbol: String, pub data: Vec, cursor: usize, } impl DataFeed { pub fn new(symbol: &str, data: Vec) -> Self { Self { symbol: symbol.to_string(), data, cursor: 0, } } pub fn reset(&mut self) { self.cursor = 0; } pub fn next(&mut self) -> Option<&DataRow> { if self.cursor < self.data.len() { let row = &self.data[self.cursor]; self.cursor += 1; Some(row) } else { None } } pub fn len(&self) -> usize { self.data.len() } pub fn is_empty(&self) -> bool { self.data.is_empty() } }