pub struct Database { /* private fields */ }Expand description
DuckDB-backed storage for ticks and bars.
Implementations§
Source§impl Database
impl Database
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open an in-memory database (for testing).
Sourcepub fn insert_ticks(&self, ticks: &[Tick]) -> Result<usize>
pub fn insert_ticks(&self, ticks: &[Tick]) -> Result<usize>
Bulk insert ticks using INSERT OR IGNORE for dedup. Returns the number of rows actually inserted.
Sourcepub fn insert_bars(&self, bars: &[Bar]) -> Result<usize>
pub fn insert_bars(&self, bars: &[Bar]) -> Result<usize>
Bulk insert bars using INSERT OR IGNORE for dedup. Returns the number of rows actually inserted.
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>>
Get summary statistics, optionally filtered by exchange and/or symbol.
Sourcepub fn query_ticks(&self, opts: &QueryOpts) -> Result<(Vec<Tick>, u64)>
pub fn query_ticks(&self, opts: &QueryOpts) -> Result<(Vec<Tick>, u64)>
Query ticks with filtering and pagination.
Sourcepub fn query_bars(&self, opts: &BarQueryOpts) -> Result<(Vec<Bar>, u64)>
pub fn query_bars(&self, opts: &BarQueryOpts) -> Result<(Vec<Bar>, u64)>
Query bars with filtering and pagination.
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl !Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl !UnwindSafe for Database
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
Mutably borrows from an owned value. Read more