#[repr(C)]pub enum BarType {
Standard {
instrument_id: InstrumentId,
spec: BarSpecification,
aggregation_source: AggregationSource,
},
Composite {
instrument_id: InstrumentId,
spec: BarSpecification,
aggregation_source: AggregationSource,
composite_step: usize,
composite_aggregation: BarAggregation,
composite_aggregation_source: AggregationSource,
},
}Expand description
Represents a bar type including the instrument ID, bar specification and aggregation source.
Variants§
Standard
Fields
instrument_id: InstrumentIdThe bar type’s instrument ID.
spec: BarSpecificationThe bar type’s specification.
aggregation_source: AggregationSourceThe bar type’s aggregation source.
Composite
Fields
instrument_id: InstrumentIdThe bar type’s instrument ID.
spec: BarSpecificationThe bar type’s specification.
aggregation_source: AggregationSourceThe bar type’s aggregation source.
composite_aggregation: BarAggregationThe composite type of bar aggregation.
composite_aggregation_source: AggregationSourceThe composite bar type’s aggregation source.
Implementations§
Source§impl BarType
impl BarType
Sourcepub fn new(
instrument_id: InstrumentId,
spec: BarSpecification,
aggregation_source: AggregationSource,
) -> Self
pub fn new( instrument_id: InstrumentId, spec: BarSpecification, aggregation_source: AggregationSource, ) -> Self
Creates a new BarType instance.
Sourcepub fn new_composite(
instrument_id: InstrumentId,
spec: BarSpecification,
aggregation_source: AggregationSource,
composite_step: usize,
composite_aggregation: BarAggregation,
composite_aggregation_source: AggregationSource,
) -> Self
pub fn new_composite( instrument_id: InstrumentId, spec: BarSpecification, aggregation_source: AggregationSource, composite_step: usize, composite_aggregation: BarAggregation, composite_aggregation_source: AggregationSource, ) -> Self
Creates a new composite BarType instance.
Sourcepub fn is_standard(&self) -> bool
pub fn is_standard(&self) -> bool
Returns whether this instance is a standard bar type.
Sourcepub fn is_composite(&self) -> bool
pub fn is_composite(&self) -> bool
Returns whether this instance is a composite bar type.
Sourcepub fn is_externally_aggregated(&self) -> bool
pub fn is_externally_aggregated(&self) -> bool
Returns whether the bar aggregation source is EXTERNAL.
Sourcepub fn is_internally_aggregated(&self) -> bool
pub fn is_internally_aggregated(&self) -> bool
Returns whether the bar aggregation source is INTERNAL.
Sourcepub fn instrument_id(&self) -> InstrumentId
pub fn instrument_id(&self) -> InstrumentId
Returns the InstrumentId for this bar type.
Sourcepub fn spec(&self) -> BarSpecification
pub fn spec(&self) -> BarSpecification
Returns the BarSpecification for this bar type.
Sourcepub fn aggregation_source(&self) -> AggregationSource
pub fn aggregation_source(&self) -> AggregationSource
Returns the AggregationSource for this bar type.
Sourcepub fn id_spec_key(&self) -> (InstrumentId, BarSpecification)
pub fn id_spec_key(&self) -> (InstrumentId, BarSpecification)
Returns the instrument ID and bar specification as a tuple key.
Useful as a hashmap key when aggregation source should be ignored, such as for indicator registration where INTERNAL and EXTERNAL bars should trigger the same indicators.
Trait Implementations§
impl Copy for BarType
Source§impl<'de> Deserialize<'de> for BarType
impl<'de> Deserialize<'de> for BarType
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>,
impl Eq for BarType
Source§impl Ord for BarType
impl Ord for BarType
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for BarType
impl PartialOrd for BarType
impl StructuralPartialEq for BarType
Auto Trait Implementations§
impl Freeze for BarType
impl RefUnwindSafe for BarType
impl Send for BarType
impl Sync for BarType
impl Unpin for BarType
impl UnsafeUnpin for BarType
impl UnwindSafe for BarType
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.