#[repr(C)]pub struct BarSpecification {
pub step: NonZeroUsize,
pub aggregation: BarAggregation,
pub price_type: PriceType,
}Expand description
Represents a bar aggregation specification including a step, aggregation method/rule and price type.
Fields§
§step: NonZeroUsizeThe step for binning samples for bar aggregation.
aggregation: BarAggregationThe type of bar aggregation.
price_type: PriceTypeThe price type to use for aggregation.
Implementations§
Source§impl BarSpecification
impl BarSpecification
Sourcepub fn new_checked(
step: usize,
aggregation: BarAggregation,
price_type: PriceType,
) -> Result<Self>
pub fn new_checked( step: usize, aggregation: BarAggregation, price_type: PriceType, ) -> Result<Self>
Creates a new BarSpecification instance with correctness checking.
§Errors
Returns an error if step is not positive (> 0), or if step is not
valid for a fixed-subunit time aggregation.
§Notes
PyO3 requires a Result type for proper error handling and stacktrace printing in Python.
Sourcepub fn new(
step: usize,
aggregation: BarAggregation,
price_type: PriceType,
) -> Self
pub fn new( step: usize, aggregation: BarAggregation, price_type: PriceType, ) -> Self
Creates a new BarSpecification instance.
§Panics
Panics if step is not positive (> 0), or if step is not valid for
a fixed-subunit time aggregation.
Sourcepub fn timedelta(&self) -> TimeDelta
pub fn timedelta(&self) -> TimeDelta
Returns the TimeDelta interval for this bar specification.
§Notes
For BarAggregation::Month and BarAggregation::Year, proxy values are used
(30 days for months, 365 days for years) to estimate their respective durations,
since months and years have variable lengths.
§Panics
Panics if the aggregation method is not time-based, or if step is too
large for the interval arithmetic.
Sourcepub fn is_time_aggregated(&self) -> bool
pub fn is_time_aggregated(&self) -> bool
Return a value indicating whether the aggregation method is time-driven:
Sourcepub fn is_threshold_aggregated(&self) -> bool
pub fn is_threshold_aggregated(&self) -> bool
Return a value indicating whether the aggregation method is threshold-driven:
Sourcepub fn is_information_aggregated(&self) -> bool
pub fn is_information_aggregated(&self) -> bool
Return a value indicating whether the aggregation method is information-driven:
Trait Implementations§
Source§impl Clone for BarSpecification
impl Clone for BarSpecification
Source§fn clone(&self) -> BarSpecification
fn clone(&self) -> BarSpecification
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BarSpecification
Source§impl Debug for BarSpecification
impl Debug for BarSpecification
Source§impl<'de> Deserialize<'de> for BarSpecification
impl<'de> Deserialize<'de> for BarSpecification
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for BarSpecification
impl Display for BarSpecification
impl Eq for BarSpecification
Source§impl Hash for BarSpecification
impl Hash for BarSpecification
Source§impl Ord for BarSpecification
impl Ord for BarSpecification
Source§fn cmp(&self, other: &BarSpecification) -> Ordering
fn cmp(&self, other: &BarSpecification) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BarSpecification
impl PartialEq for BarSpecification
Source§fn eq(&self, other: &BarSpecification) -> bool
fn eq(&self, other: &BarSpecification) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for BarSpecification
impl PartialOrd for BarSpecification
Source§impl Serialize for BarSpecification
impl Serialize for BarSpecification
impl StructuralPartialEq for BarSpecification
Auto Trait Implementations§
impl Freeze for BarSpecification
impl RefUnwindSafe for BarSpecification
impl Send for BarSpecification
impl Sync for BarSpecification
impl Unpin for BarSpecification
impl UnsafeUnpin for BarSpecification
impl UnwindSafe for BarSpecification
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.