pub struct SyntheticInstrument {
pub id: InstrumentId,
pub price_precision: u8,
pub price_increment: Price,
pub components: Vec<InstrumentId>,
pub formula: String,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
/* private fields */
}
Expand description
Represents a synthetic instrument with prices derived from component instruments using a formula.
Fields§
§id: InstrumentId
§price_precision: u8
§price_increment: Price
§components: Vec<InstrumentId>
§formula: String
§ts_event: UnixNanos
§ts_init: UnixNanos
Implementations§
Source§impl SyntheticInstrument
impl SyntheticInstrument
Sourcepub fn new_checked(
symbol: Symbol,
price_precision: u8,
components: Vec<InstrumentId>,
formula: String,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Result<Self>
pub fn new_checked( symbol: Symbol, price_precision: u8, components: Vec<InstrumentId>, formula: String, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Result<Self>
Creates a new SyntheticInstrument
instance with correctness checking.
§Notes
PyO3 requires a Result
type for proper error handling and stacktrace printing in Python.
Sourcepub fn new(
symbol: Symbol,
price_precision: u8,
components: Vec<InstrumentId>,
formula: String,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Self
pub fn new( symbol: Symbol, price_precision: u8, components: Vec<InstrumentId>, formula: String, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Self
Creates a new SyntheticInstrument
instance
pub fn is_valid_formula(&self, formula: &str) -> bool
pub fn change_formula(&mut self, formula: String) -> Result<()>
Trait Implementations§
Source§impl Clone for SyntheticInstrument
impl Clone for SyntheticInstrument
Source§fn clone(&self) -> SyntheticInstrument
fn clone(&self) -> SyntheticInstrument
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SyntheticInstrument
impl Debug for SyntheticInstrument
Source§impl Default for SyntheticInstrument
impl Default for SyntheticInstrument
Source§fn default() -> Self
fn default() -> Self
Creates a new default SyntheticInstrument
instance for testing.
Source§impl Hash for SyntheticInstrument
impl Hash for SyntheticInstrument
Source§impl IntoPy<Py<PyAny>> for SyntheticInstrument
impl IntoPy<Py<PyAny>> for SyntheticInstrument
Source§impl PartialEq for SyntheticInstrument
impl PartialEq for SyntheticInstrument
Source§impl PyClass for SyntheticInstrument
impl PyClass for SyntheticInstrument
Source§impl PyClassImpl for SyntheticInstrument
impl PyClassImpl for SyntheticInstrument
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§type ThreadChecker = SendablePyClass<SyntheticInstrument>
type ThreadChecker = SendablePyClass<SyntheticInstrument>
This handles following two situations: Read more
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
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<'a, 'py> PyFunctionArgument<'a, 'py> for &'a SyntheticInstrument
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a SyntheticInstrument
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut SyntheticInstrument
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut SyntheticInstrument
Source§impl PyTypeInfo for SyntheticInstrument
impl PyTypeInfo for SyntheticInstrument
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type.impl DerefToPyAny for SyntheticInstrument
impl Eq for SyntheticInstrument
Auto Trait Implementations§
impl Freeze for SyntheticInstrument
impl !RefUnwindSafe for SyntheticInstrument
impl Send for SyntheticInstrument
impl Sync for SyntheticInstrument
impl Unpin for SyntheticInstrument
impl !UnwindSafe for SyntheticInstrument
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key
and return true
if they are equal.