pub struct OrderBookDepth {
pub instrument_id: InstrumentId,
pub bids: SmallVec<[BookOrder; 10]>,
pub asks: SmallVec<[BookOrder; 10]>,
pub bid_counts: SmallVec<[u32; 10]>,
pub ask_counts: SmallVec<[u32; 10]>,
pub flags: u8,
pub sequence: u64,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}Expand description
Represents one aggregated order book snapshot with any number of levels per side.
The plural name denotes the many levels in one snapshot. In contrast, super::OrderBookDeltas
is a container of multiple update events. Up to ten levels per side remain inline; deeper venue
snapshots spill transparently without changing the data type.
Per-level BookOrder::order_id values are retained when supplied by the venue.
Fields§
§instrument_id: InstrumentIdThe instrument ID for the book.
bids: SmallVec<[BookOrder; 10]>The bid orders for the depth update.
asks: SmallVec<[BookOrder; 10]>The ask orders for the depth update.
bid_counts: SmallVec<[u32; 10]>The count of bid orders per level for the depth update.
ask_counts: SmallVec<[u32; 10]>The count of ask orders per level for the depth update.
flags: u8The record flags bit field, indicating event end and data information.
sequence: u64The message sequence number assigned at the venue.
ts_event: UnixNanosUNIX timestamp (nanoseconds) when the book event occurred.
ts_init: UnixNanosUNIX timestamp (nanoseconds) when the instance was created.
Implementations§
Source§impl OrderBookDepth
impl OrderBookDepth
Sourcepub fn new<B, A, BC, AC>(
instrument_id: InstrumentId,
bids: B,
asks: A,
bid_counts: BC,
ask_counts: AC,
flags: u8,
sequence: u64,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Selfwhere
B: IntoIterator<Item = BookOrder>,
A: IntoIterator<Item = BookOrder>,
BC: IntoIterator<Item = u32>,
AC: IntoIterator<Item = u32>,
pub fn new<B, A, BC, AC>(
instrument_id: InstrumentId,
bids: B,
asks: A,
bid_counts: BC,
ask_counts: AC,
flags: u8,
sequence: u64,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Selfwhere
B: IntoIterator<Item = BookOrder>,
A: IntoIterator<Item = BookOrder>,
BC: IntoIterator<Item = u32>,
AC: IntoIterator<Item = u32>,
Creates a new OrderBookDepth instance.
§Panics
Panics if either order side and its count vector have different lengths.
Sourcepub fn new_checked<B, A, BC, AC>(
instrument_id: InstrumentId,
bids: B,
asks: A,
bid_counts: BC,
ask_counts: AC,
flags: u8,
sequence: u64,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Result<Self>where
B: IntoIterator<Item = BookOrder>,
A: IntoIterator<Item = BookOrder>,
BC: IntoIterator<Item = u32>,
AC: IntoIterator<Item = u32>,
pub fn new_checked<B, A, BC, AC>(
instrument_id: InstrumentId,
bids: B,
asks: A,
bid_counts: BC,
ask_counts: AC,
flags: u8,
sequence: u64,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Result<Self>where
B: IntoIterator<Item = BookOrder>,
A: IntoIterator<Item = BookOrder>,
BC: IntoIterator<Item = u32>,
AC: IntoIterator<Item = u32>,
Creates a new OrderBookDepth instance after validating its levels.
§Errors
Returns an error if an order side and its count vector have different lengths, or if a retained level has the wrong side. Levels with no side, a non-positive or undefined size, or an undefined or error price are omitted with their count entries.
Sourcepub fn get_metadata(
instrument_id: &InstrumentId,
price_precision: u8,
size_precision: u8,
) -> HashMap<String, String>
pub fn get_metadata( instrument_id: &InstrumentId, price_precision: u8, size_precision: u8, ) -> HashMap<String, String>
Returns the metadata for the type, for use with serialization formats.
Sourcepub fn get_fields() -> IndexMap<String, String>
pub fn get_fields() -> IndexMap<String, String>
Returns the field map for the type, for use with Arrow schemas.
Trait Implementations§
Source§impl Clone for OrderBookDepth
impl Clone for OrderBookDepth
Source§impl Debug for OrderBookDepth
impl Debug for OrderBookDepth
impl DerefToPyAny for OrderBookDepth
Source§impl<'de> Deserialize<'de> for OrderBookDepth
impl<'de> Deserialize<'de> for OrderBookDepth
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 OrderBookDepth
impl Display for OrderBookDepth
impl Eq for OrderBookDepth
Source§impl From<OrderBookDepth10Ffi> for OrderBookDepth
impl From<OrderBookDepth10Ffi> for OrderBookDepth
Source§fn from(value: OrderBookDepth10Ffi) -> Self
fn from(value: OrderBookDepth10Ffi) -> Self
Source§impl From<OrderBookDepth> for Data
impl From<OrderBookDepth> for Data
Source§fn from(value: OrderBookDepth) -> Self
fn from(value: OrderBookDepth) -> Self
Source§impl FromDataBatch for OrderBookDepth
impl FromDataBatch for OrderBookDepth
Source§impl<'a, 'py> FromPyObject<'a, 'py> for OrderBookDepthwhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for OrderBookDepthwhere
Self: Clone,
Source§impl HasTsInit for OrderBookDepth
impl HasTsInit for OrderBookDepth
Source§impl Hash for OrderBookDepth
impl Hash for OrderBookDepth
Source§impl IntoDataBatch for OrderBookDepth
impl IntoDataBatch for OrderBookDepth
Source§impl<'py> IntoPyObject<'py> for OrderBookDepth
impl<'py> IntoPyObject<'py> for OrderBookDepth
Source§type Target = OrderBookDepth
type Target = OrderBookDepth
Source§type Output = Bound<'py, <OrderBookDepth as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <OrderBookDepth 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 PartialEq for OrderBookDepth
impl PartialEq for OrderBookDepth
Source§impl PyClass for OrderBookDepth
impl PyClass for OrderBookDepth
Source§impl PyClassImpl for OrderBookDepth
impl PyClassImpl for OrderBookDepth
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
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 one aggregated order book snapshot with any number of levels per side.
///
/// The plural name denotes the many levels in one snapshot. In contrast, [`super::OrderBookDeltas`]
/// is a container of multiple update events. Up to ten levels per side remain inline; deeper venue
/// snapshots spill transparently without changing the data type.
///
/// Per-level [`BookOrder::order_id`] values are retained when supplied by the venue.
const RAW_DOC: &'static CStr = /// Represents one aggregated order book snapshot with any number of levels per side. /// /// The plural name denotes the many levels in one snapshot. In contrast, [`super::OrderBookDeltas`] /// is a container of multiple update events. Up to ten levels per side remain inline; deeper venue /// snapshots spill transparently without changing the data type. /// /// Per-level [`BookOrder::order_id`] values are retained when supplied by the venue.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<OrderBookDepth as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<OrderBookDepth>
type Layout = <<OrderBookDepth as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<OrderBookDepth>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForOrderBookDepth
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
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 OrderBookDepth
impl PyClassNewTextSignature for OrderBookDepth
const TEXT_SIGNATURE: &'static str = "(instrument_id, bids, asks, bid_counts, ask_counts, flags, sequence, ts_event, ts_init)"
Source§impl PyStubType for OrderBookDepth
impl PyStubType for OrderBookDepth
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for OrderBookDepth
impl PyTypeInfo for OrderBookDepth
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.Source§impl Serializable for OrderBookDepth
impl Serializable for OrderBookDepth
Source§impl Serialize for OrderBookDepth
impl Serialize for OrderBookDepth
impl StructuralPartialEq for OrderBookDepth
Source§impl TryFrom<Data> for OrderBookDepth
impl TryFrom<Data> for OrderBookDepth
Source§impl TryFrom<OrderBookDepth> for OrderBookDepth10Ffi
impl TryFrom<OrderBookDepth> for OrderBookDepth10Ffi
Auto Trait Implementations§
impl Freeze for OrderBookDepth
impl RefUnwindSafe for OrderBookDepth
impl Send for OrderBookDepth
impl Sync for OrderBookDepth
impl Unpin for OrderBookDepth
impl UnsafeUnpin for OrderBookDepth
impl UnwindSafe for OrderBookDepth
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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
§impl<T> FromMsgPack for Twhere
T: Serializable,
impl<T> FromMsgPack for Twhere
T: Serializable,
§fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
MsgPack encoded bytes. Read moreimpl<'py, T> FromPyObjectOwned<'py> for Twhere
T: for<'a> FromPyObject<'a, 'py>,
§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>where
Self: IntoPyObject<'py, Error = !>,
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>where
Self: IntoPyObject<'py, Error = !>,
self into a [Py<PyAny>] when the underlying conversion is infallible.impl<T> MsgPackSerializable for Twhere
T: Serializable,
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ToMsgPack for Twhere
T: Serializable,
impl<T> ToMsgPack for Twhere
T: Serializable,
§fn to_msgpack_bytes(&self) -> Result<Bytes, Error>
fn to_msgpack_bytes(&self) -> Result<Bytes, Error>
MsgPack encoded bytes. Read more