#[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 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§
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>,
Source§impl<'py> IntoPyObject<'py> for BarType
impl<'py> IntoPyObject<'py> for BarType
Source§type Output = Bound<'py, <BarType as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <BarType as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl Ord for BarType
impl Ord for BarType
Source§impl PartialOrd for BarType
impl PartialOrd for BarType
Source§impl PyClassBaseType for BarType
impl PyClassBaseType for BarType
type LayoutAsBase = PyClassObject<BarType>
type BaseNativeType = <BarType as PyClassImpl>::BaseNativeType
type Initializer = PyClassInitializer<BarType>
type PyClassMutability = <BarType as PyClassImpl>::PyClassMutability
Source§impl PyClassImpl for BarType
impl PyClassImpl for BarType
Source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Represents a bar type including the instrument ID, bar specification and
/// aggregation source.
const RAW_DOC: &'static CStr = /// Represents a bar type including the instrument ID, bar specification and /// aggregation source.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<BarType>
type ThreadChecker = SendablePyClass<BarType>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature for BarType
impl PyClassNewTextSignature for BarType
const TEXT_SIGNATURE: &'static str = "(instrument_id, spec, aggregation_source=...)"
Source§impl PyMethods<BarType> for PyClassImplCollector<BarType>
impl PyMethods<BarType> for PyClassImplCollector<BarType>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for BarType
impl PyTypeInfo for BarType
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl Copy for BarType
impl Eq for BarType
impl ExtractPyClassWithClone 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 UnwindSafe for BarType
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> 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
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.Source§impl<'a, 'py, T> FromPyObject<'a, 'py> for T
impl<'a, 'py, T> FromPyObject<'a, 'py> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.