pub struct OwnOrderBook {
pub instrument_id: InstrumentId,
pub ts_last: UnixNanos,
pub update_count: u64,
/* private fields */
}
Fields§
§instrument_id: InstrumentId
The instrument ID for the order book.
ts_last: UnixNanos
The timestamp of the last event applied to the order book.
update_count: u64
The current count of updates applied to the order book.
Implementations§
Source§impl OwnOrderBook
impl OwnOrderBook
Sourcepub fn new(instrument_id: InstrumentId) -> Self
pub fn new(instrument_id: InstrumentId) -> Self
Creates a new OwnOrderBook
instance.
Sourcepub fn add(&mut self, order: OwnBookOrder)
pub fn add(&mut self, order: OwnBookOrder)
Adds an own order to the book.
Sourcepub fn update(&mut self, order: OwnBookOrder) -> Result<()>
pub fn update(&mut self, order: OwnBookOrder) -> Result<()>
Sourcepub fn delete(&mut self, order: OwnBookOrder) -> Result<()>
pub fn delete(&mut self, order: OwnBookOrder) -> Result<()>
Sourcepub fn bids(&self) -> impl Iterator<Item = &OwnBookLevel>
pub fn bids(&self) -> impl Iterator<Item = &OwnBookLevel>
Returns an iterator over bid price levels.
Sourcepub fn asks(&self) -> impl Iterator<Item = &OwnBookLevel>
pub fn asks(&self) -> impl Iterator<Item = &OwnBookLevel>
Returns an iterator over ask price levels.
Sourcepub fn bid_client_order_ids(&self) -> Vec<ClientOrderId>
pub fn bid_client_order_ids(&self) -> Vec<ClientOrderId>
Returns the client order IDs currently on the bid side.
Sourcepub fn ask_client_order_ids(&self) -> Vec<ClientOrderId>
pub fn ask_client_order_ids(&self) -> Vec<ClientOrderId>
Returns the client order IDs currently on the ask side.
Sourcepub fn is_order_in_book(&self, client_order_id: &ClientOrderId) -> bool
pub fn is_order_in_book(&self, client_order_id: &ClientOrderId) -> bool
Return whether the given client order ID is in the own book.
Sourcepub fn bids_as_map(
&self,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Vec<OwnBookOrder>>
pub fn bids_as_map( &self, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Vec<OwnBookOrder>>
Maps bid price levels to their own orders, excluding empty levels after filtering.
Filters by status
if provided. With accepted_buffer_ns
, only includes orders accepted
at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn asks_as_map(
&self,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Vec<OwnBookOrder>>
pub fn asks_as_map( &self, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Vec<OwnBookOrder>>
Maps ask price levels to their own orders, excluding empty levels after filtering.
Filters by status
if provided. With accepted_buffer_ns
, only includes orders accepted
at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn bid_quantity(
&self,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Decimal>
pub fn bid_quantity( &self, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Decimal>
Aggregates own bid quantities per price level, omitting zero-quantity levels.
Filters by status
if provided, including only matching orders. With accepted_buffer_ns
,
only includes orders accepted at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn ask_quantity(
&self,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Decimal>
pub fn ask_quantity( &self, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Decimal>
Aggregates own ask quantities per price level, omitting zero-quantity levels.
Filters by status
if provided, including only matching orders. With accepted_buffer_ns
,
only includes orders accepted at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn group_bids(
&self,
group_size: Decimal,
depth: Option<usize>,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Decimal>
pub fn group_bids( &self, group_size: Decimal, depth: Option<usize>, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Decimal>
Groups own bid quantities by price into buckets, truncating to a maximum depth.
Filters by status
if provided. With accepted_buffer_ns
, only includes orders accepted
at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn group_asks(
&self,
group_size: Decimal,
depth: Option<usize>,
status: Option<HashSet<OrderStatus>>,
accepted_buffer_ns: Option<u64>,
ts_now: Option<u64>,
) -> IndexMap<Decimal, Decimal>
pub fn group_asks( &self, group_size: Decimal, depth: Option<usize>, status: Option<HashSet<OrderStatus>>, accepted_buffer_ns: Option<u64>, ts_now: Option<u64>, ) -> IndexMap<Decimal, Decimal>
Groups own ask quantities by price into buckets, truncating to a maximum depth.
Filters by status
if provided. With accepted_buffer_ns
, only includes orders accepted
at least that many nanoseconds before ts_now
(defaults to now).
Sourcepub fn pprint(&self, num_levels: usize) -> String
pub fn pprint(&self, num_levels: usize) -> String
Return a formatted string representation of the order book.
pub fn audit_open_orders(&mut self, open_order_ids: &HashSet<ClientOrderId>)
Source§impl OwnOrderBook
impl OwnOrderBook
pub fn py_bid_client_order_ids(&self) -> Vec<ClientOrderId>
pub fn py_ask_client_order_ids(&self) -> Vec<ClientOrderId>
pub fn py_is_order_in_book(&self, client_order_id: &ClientOrderId) -> bool
Trait Implementations§
Source§impl Debug for OwnOrderBook
impl Debug for OwnOrderBook
Source§impl Display for OwnOrderBook
impl Display for OwnOrderBook
Source§impl IntoPy<Py<PyAny>> for OwnOrderBook
impl IntoPy<Py<PyAny>> for OwnOrderBook
Source§impl<'py> IntoPyObject<'py> for OwnOrderBook
impl<'py> IntoPyObject<'py> for OwnOrderBook
Source§type Target = OwnOrderBook
type Target = OwnOrderBook
Source§type Output = Bound<'py, <OwnOrderBook as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <OwnOrderBook 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 OwnOrderBook
impl PartialEq for OwnOrderBook
Source§impl PyClass for OwnOrderBook
impl PyClass for OwnOrderBook
Source§impl PyClassImpl for OwnOrderBook
impl PyClassImpl for OwnOrderBook
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§type ThreadChecker = SendablePyClass<OwnOrderBook>
type ThreadChecker = SendablePyClass<OwnOrderBook>
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<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<OwnOrderBook> for PyClassImplCollector<OwnOrderBook>
impl PyClassNewTextSignature<OwnOrderBook> for PyClassImplCollector<OwnOrderBook>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a OwnOrderBook
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a OwnOrderBook
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut OwnOrderBook
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut OwnOrderBook
Source§impl PyMethods<OwnOrderBook> for PyClassImplCollector<OwnOrderBook>
impl PyMethods<OwnOrderBook> for PyClassImplCollector<OwnOrderBook>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for OwnOrderBook
impl PyTypeInfo for OwnOrderBook
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 type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
].§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_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
].§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.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
].impl DerefToPyAny for OwnOrderBook
Auto Trait Implementations§
impl Freeze for OwnOrderBook
impl RefUnwindSafe for OwnOrderBook
impl Send for OwnOrderBook
impl Sync for OwnOrderBook
impl Unpin for OwnOrderBook
impl UnwindSafe for OwnOrderBook
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
§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 moreSource§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>
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy
. Read more