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.
The id
for the synthetic will become {symbol}.{SYNTH}
.
Fields§
§id: InstrumentId
The unique identifier for the synthetic instrument.
price_precision: u8
The price precision for the synthetic instrument.
price_increment: Price
The minimum price increment.
components: Vec<InstrumentId>
The component instruments for the synthetic instrument.
formula: String
The derivation formula for the synthetic instrument.
ts_event: UnixNanos
UNIX timestamp (nanoseconds) when the data event occurred.
ts_init: UnixNanos
UNIX timestamp (nanoseconds) when the data object was initialized.
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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<SyntheticInstrument>
type ThreadChecker = SendablePyClass<SyntheticInstrument>
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<'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
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
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
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
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
§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.