pub trait PriceTicksRepositoryRead: Send + Sync {
// Required methods
fn get_latest_entry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_price_range_from<'life0, 'async_trait>(
&'life0 self,
start: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<(f64, f64, DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Read-only price tick repository API.
Required Methods§
Sourcefn get_latest_entry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_entry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<(DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the latest known price entry as (time, price), or None when no price data exists.
let latest = db.price_ticks().get_latest_entry().await?;Sourcefn get_price_range_from<'life0, 'async_trait>(
&'life0 self,
start: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<(f64, f64, DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_price_range_from<'life0, 'async_trait>(
&'life0 self,
start: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<(f64, f64, DateTime<Utc>, f64)>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the price range since start as (min_price, max_price, latest_time, latest_price).
use chrono::{Duration, Utc};
let start = Utc::now() - Duration::hours(24);
let range = db.price_ticks().get_price_range_from(start).await?;Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".