pub struct ParquetStore { /* private fields */ }Expand description
Parquet-based storage backend for tick and bar data.
Implementations§
Source§impl ParquetStore
impl ParquetStore
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open(root: impl AsRef<Path>) -> Result<Self>
Open a Parquet data store rooted at the given directory, creating it if needed.
Sourcepub fn insert_ticks(&self, ticks: &[Tick]) -> Result<usize>
pub fn insert_ticks(&self, ticks: &[Tick]) -> Result<usize>
Import ticks, deduplicating against existing data per date partition. Returns the number of rows actually inserted (after dedup).
Sourcepub fn insert_bars(&self, bars: &[Bar]) -> Result<usize>
pub fn insert_bars(&self, bars: &[Bar]) -> Result<usize>
Import bars, deduplicating against existing data per date partition. Returns the number of rows actually inserted (after dedup).
Sourcepub fn query_ticks(&self, opts: &QueryOpts) -> Result<(Vec<Tick>, u64)>
pub fn query_ticks(&self, opts: &QueryOpts) -> Result<(Vec<Tick>, u64)>
Query ticks for a given exchange+symbol, optionally filtered by date range. Returns (ticks, total_count_matching_filters).
Sourcepub fn query_ticks_cancellable<F>(
&self,
opts: &QueryOpts,
is_cancelled: F,
) -> Result<(Vec<Tick>, u64)>
pub fn query_ticks_cancellable<F>( &self, opts: &QueryOpts, is_cancelled: F, ) -> Result<(Vec<Tick>, u64)>
Cancellable tick query.
Cancellation is checked while traversing directory entries, before and after every Parquet file, and between DataFrame processing stages. The low-level Polars collect/read for one file remains atomic because Polars does not expose an interruption hook for that operation.
Sourcepub fn latest_valid_tick_before(
&self,
exchange: &str,
symbol: &str,
before: NaiveDateTime,
) -> Result<Option<Tick>>
pub fn latest_valid_tick_before( &self, exchange: &str, symbol: &str, before: NaiveDateTime, ) -> Result<Option<Tick>>
Return the latest tick with a valid quote strictly before before.
Sourcepub fn latest_valid_tick_before_cancellable<F>(
&self,
exchange: &str,
symbol: &str,
before: NaiveDateTime,
is_cancelled: F,
) -> Result<Option<Tick>>
pub fn latest_valid_tick_before_cancellable<F>( &self, exchange: &str, symbol: &str, before: NaiveDateTime, is_cancelled: F, ) -> Result<Option<Tick>>
Cancellable strict-before lookup for the latest tick with a valid quote.
Date partitions and their rows are searched newest-to-oldest.
Ticks at before are excluded, and ticks with missing, non-finite, non-positive, or crossed bid/ask prices are skipped.
Sourcepub fn query_bars(&self, opts: &BarQueryOpts) -> Result<(Vec<Bar>, u64)>
pub fn query_bars(&self, opts: &BarQueryOpts) -> Result<(Vec<Bar>, u64)>
Query bars for a given exchange+symbol+timeframe, optionally filtered by date range. Returns (bars, total_count_matching_filters).
Sourcepub fn query_bars_cancellable<F>(
&self,
opts: &BarQueryOpts,
is_cancelled: F,
) -> Result<(Vec<Bar>, u64)>
pub fn query_bars_cancellable<F>( &self, opts: &BarQueryOpts, is_cancelled: F, ) -> Result<(Vec<Bar>, u64)>
Cancellable bar query with the same cooperative boundaries as
Self::query_ticks_cancellable.
Sourcepub fn delete_ticks(
&self,
exchange: &str,
symbol: &str,
from: Option<NaiveDateTime>,
to: Option<NaiveDateTime>,
) -> Result<usize>
pub fn delete_ticks( &self, exchange: &str, symbol: &str, from: Option<NaiveDateTime>, to: Option<NaiveDateTime>, ) -> Result<usize>
Delete ticks matching exchange+symbol, optionally within a date range.
Sourcepub fn delete_bars(
&self,
exchange: &str,
symbol: &str,
timeframe: &str,
from: Option<NaiveDateTime>,
to: Option<NaiveDateTime>,
) -> Result<usize>
pub fn delete_bars( &self, exchange: &str, symbol: &str, timeframe: &str, from: Option<NaiveDateTime>, to: Option<NaiveDateTime>, ) -> Result<usize>
Delete bars matching exchange+symbol+timeframe, optionally within a date range.
Sourcepub fn delete_symbol(
&self,
exchange: &str,
symbol: &str,
) -> Result<(usize, usize)>
pub fn delete_symbol( &self, exchange: &str, symbol: &str, ) -> Result<(usize, usize)>
Delete ALL data (ticks + bars) for an exchange+symbol pair.
Sourcepub fn delete_exchange(&self, exchange: &str) -> Result<(usize, usize)>
pub fn delete_exchange(&self, exchange: &str) -> Result<(usize, usize)>
Delete ALL data for an entire exchange.
Sourcepub fn stats(
&self,
exchange: Option<&str>,
symbol: Option<&str>,
) -> Result<Vec<StatRow>>
pub fn stats( &self, exchange: Option<&str>, symbol: Option<&str>, ) -> Result<Vec<StatRow>>
Summary statistics across all data, optionally filtered by exchange and/or symbol.
Sourcepub fn total_size(&self) -> Option<u64>
pub fn total_size(&self) -> Option<u64>
Total size of all Parquet files under the data root (bytes).
Source§impl ParquetStore
impl ParquetStore
Sourcepub fn scan_ticks(
&self,
exchange: &str,
symbol: &str,
bounds: ParquetScanBounds,
) -> Result<ParquetTickCursor>
pub fn scan_ticks( &self, exchange: &str, symbol: &str, bounds: ParquetScanBounds, ) -> Result<ParquetTickCursor>
Create an ascending tick cursor over this store.
Sourcepub fn scan_ticks_cancellable<F>(
&self,
exchange: &str,
symbol: &str,
bounds: ParquetScanBounds,
is_cancelled: F,
) -> Result<ParquetTickCursor>
pub fn scan_ticks_cancellable<F>( &self, exchange: &str, symbol: &str, bounds: ParquetScanBounds, is_cancelled: F, ) -> Result<ParquetTickCursor>
Create an ascending tick cursor with cancellable partition discovery.
Sourcepub fn scan_bars(
&self,
exchange: &str,
symbol: &str,
timeframe: &str,
bounds: ParquetScanBounds,
) -> Result<ParquetBarCursor>
pub fn scan_bars( &self, exchange: &str, symbol: &str, timeframe: &str, bounds: ParquetScanBounds, ) -> Result<ParquetBarCursor>
Create an ascending bar cursor over this store.
Sourcepub fn scan_bars_cancellable<F>(
&self,
exchange: &str,
symbol: &str,
timeframe: &str,
bounds: ParquetScanBounds,
is_cancelled: F,
) -> Result<ParquetBarCursor>
pub fn scan_bars_cancellable<F>( &self, exchange: &str, symbol: &str, timeframe: &str, bounds: ParquetScanBounds, is_cancelled: F, ) -> Result<ParquetBarCursor>
Create an ascending bar cursor with cancellable partition discovery.
Auto Trait Implementations§
impl Freeze for ParquetStore
impl RefUnwindSafe for ParquetStore
impl Send for ParquetStore
impl Sync for ParquetStore
impl Unpin for ParquetStore
impl UnsafeUnpin for ParquetStore
impl UnwindSafe for ParquetStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more