#[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§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 = <BarType as PyClassImpl>::Layout
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 Layout = <<BarType as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<BarType>
type Layout = <<BarType as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<BarType>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForBarType
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<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for BarType
impl PyClassNewTextSignature for BarType
const TEXT_SIGNATURE: &'static str = "(instrument_id, spec, aggregation_source=...)"
Source§impl PyStubType for BarType
impl PyStubType for BarType
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for BarType
impl PyTypeInfo for BarType
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl Copy for BarType
impl Eq 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§
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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 more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§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.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more