pub struct CandleReader<R: Read> { /* private fields */ }Expand description
Streaming OHLCV CSV reader.
Implementations§
Source§impl CandleReader<BomStripReader<File>>
impl CandleReader<BomStripReader<File>>
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open a CSV file at path.
The first line must be a header row naming the OHLCV columns; a leading UTF-8 BOM and whitespace around values are tolerated.
§Errors
Returns Error::Io if the file cannot be opened and
Error::Malformed if the header does not contain every required
column (timestamp,open,high,low,close,volume).
Source§impl<R: Read> CandleReader<BomStripReader<R>>
impl<R: Read> CandleReader<BomStripReader<R>>
Sourcepub fn from_reader(inner: R) -> Result<Self>
pub fn from_reader(inner: R) -> Result<Self>
Build a reader from any std::io::Read source.
A leading UTF-8 BOM is stripped and the header is validated.
§Errors
Returns Error::Malformed if the header does not contain every
required column.
Source§impl<R: Read> CandleReader<R>
impl<R: Read> CandleReader<R>
Sourcepub fn from_csv_reader(reader: Reader<R>) -> Result<Self>
pub fn from_csv_reader(reader: Reader<R>) -> Result<Self>
Wrap a pre-built csv::Reader; useful for testing or for non-default
reader configuration.
Unlike from_reader this does not strip a BOM —
the caller owns the reader’s configuration — but the header is still
validated.
§Errors
Returns Error::Malformed if the header does not contain every
required column.