#[repr(C)]pub enum InstrumentClass {
Spot = 1,
Swap = 2,
Future = 3,
FuturesSpread = 4,
Forward = 5,
Cfd = 6,
Bond = 7,
Option = 8,
OptionSpread = 9,
Warrant = 10,
SportsBetting = 11,
BinaryOption = 12,
}Expand description
The instrument class.
Variants§
Spot = 1
A spot market instrument class. The current market price of an instrument that is bought or sold for immediate delivery and payment.
Swap = 2
A swap instrument class. A derivative contract through which two parties exchange the cash flows or liabilities from two different financial instruments.
Future = 3
A futures contract instrument class. A legal agreement to buy or sell an asset at a predetermined price at a specified time in the future.
FuturesSpread = 4
A futures spread instrument class. A strategy involving the use of futures contracts to take advantage of price differentials between different contract months, underlying assets, or marketplaces.
Forward = 5
A forward derivative instrument class. A customized contract between two parties to buy or sell an asset at a specified price on a future date.
Cfd = 6
A contract-for-difference (CFD) instrument class. A contract between an investor and a CFD broker to exchange the difference in the value of a financial product between the time the contract opens and closes.
Bond = 7
A bond instrument class. A type of debt investment where an investor loans money to an entity (typically corporate or governmental) which borrows the funds for a defined period of time at a variable or fixed interest rate.
Option = 8
An option contract instrument class. A type of derivative that gives the holder the right, but not the obligation, to buy or sell an underlying asset at a predetermined price before or at a certain future date.
OptionSpread = 9
An option spread instrument class. A strategy involving the purchase and/or sale of multiple option contracts on the same underlying asset with different strike prices or expiration dates to hedge risk or speculate on price movements.
Warrant = 10
A warrant instrument class. A derivative that gives the holder the right, but not the obligation, to buy or sell a security—most commonly an equity—at a certain price before expiration.
SportsBetting = 11
A sports betting instrument class. A financialized derivative that allows wagering on the outcome of sports events using structured contracts or prediction markets.
BinaryOption = 12
A binary option instrument class. A type of derivative where the payoff is either a fixed monetary amount or nothing, depending on whether the price of an underlying asset is above or below a predetermined level at expiration.
Implementations§
Source§impl InstrumentClass
impl InstrumentClass
Sourcepub const fn has_expiration(&self) -> bool
pub const fn has_expiration(&self) -> bool
Returns whether this instrument class has an expiration.
Sourcepub const fn allows_negative_price(&self) -> bool
pub const fn allows_negative_price(&self) -> bool
Returns whether this instrument class allows negative prices.
Trait Implementations§
Source§impl AsRef<str> for InstrumentClass
impl AsRef<str> for InstrumentClass
Source§impl Clone for InstrumentClass
impl Clone for InstrumentClass
Source§fn clone(&self) -> InstrumentClass
fn clone(&self) -> InstrumentClass
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InstrumentClass
impl Debug for InstrumentClass
Source§impl<'de> Deserialize<'de> for InstrumentClass
impl<'de> Deserialize<'de> for InstrumentClass
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 InstrumentClass
impl Display for InstrumentClass
Source§impl<'a, 'py> FromPyObject<'a, 'py> for InstrumentClasswhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for InstrumentClasswhere
Self: Clone,
Source§impl FromStr for InstrumentClass
impl FromStr for InstrumentClass
Source§impl Hash for InstrumentClass
impl Hash for InstrumentClass
Source§impl IntoEnumIterator for InstrumentClass
impl IntoEnumIterator for InstrumentClass
type Iterator = InstrumentClassIter
fn iter() -> InstrumentClassIter ⓘ
Source§impl<'py> IntoPyObject<'py> for InstrumentClass
impl<'py> IntoPyObject<'py> for InstrumentClass
Source§type Target = InstrumentClass
type Target = InstrumentClass
Source§type Output = Bound<'py, <InstrumentClass as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <InstrumentClass as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
Source§impl Ord for InstrumentClass
impl Ord for InstrumentClass
Source§fn cmp(&self, other: &InstrumentClass) -> Ordering
fn cmp(&self, other: &InstrumentClass) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for InstrumentClass
impl PartialEq for InstrumentClass
Source§impl PartialOrd for InstrumentClass
impl PartialOrd for InstrumentClass
Source§impl PyClass for InstrumentClass
impl PyClass for InstrumentClass
Source§impl PyClassImpl for InstrumentClass
impl PyClassImpl for InstrumentClass
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 = /// The instrument class.
const RAW_DOC: &'static CStr = /// The instrument class.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<InstrumentClass as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<InstrumentClass>
type Layout = <<InstrumentClass as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<InstrumentClass>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForInstrumentClass
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>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for InstrumentClass
impl PyClassNewTextSignature for InstrumentClass
const TEXT_SIGNATURE: &'static str = "(value)"
Source§impl PyStubType for InstrumentClass
impl PyStubType for InstrumentClass
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
Source§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for InstrumentClass
impl PyTypeInfo for InstrumentClass
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
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§impl Serialize for InstrumentClass
impl Serialize for InstrumentClass
Source§impl TryFrom<&str> for InstrumentClass
impl TryFrom<&str> for InstrumentClass
impl Copy for InstrumentClass
impl Eq for InstrumentClass
impl StructuralPartialEq for InstrumentClass
Auto Trait Implementations§
impl Freeze for InstrumentClass
impl RefUnwindSafe for InstrumentClass
impl Send for InstrumentClass
impl Sync for InstrumentClass
impl Unpin for InstrumentClass
impl UnsafeUnpin for InstrumentClass
impl UnwindSafe for InstrumentClass
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§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.Source§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§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.