#[repr(C)]pub struct CryptoOption {Show 28 fields
pub id: InstrumentId,
pub raw_symbol: Symbol,
pub underlying: Currency,
pub quote_currency: Currency,
pub settlement_currency: Currency,
pub is_inverse: bool,
pub option_kind: OptionKind,
pub strike_price: Price,
pub activation_ns: UnixNanos,
pub expiration_ns: UnixNanos,
pub price_precision: u8,
pub size_precision: u8,
pub price_increment: Price,
pub size_increment: Quantity,
pub multiplier: Quantity,
pub lot_size: Quantity,
pub margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub max_quantity: Option<Quantity>,
pub min_quantity: Option<Quantity>,
pub max_notional: Option<Money>,
pub min_notional: Option<Money>,
pub max_price: Option<Price>,
pub min_price: Option<Price>,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}
Expand description
Represents a generic option contract instrument.
Fields§
§id: InstrumentId
The instrument ID.
raw_symbol: Symbol
The raw/local/native symbol for the instrument, assigned by the venue.
underlying: Currency
The underlying asset.
quote_currency: Currency
The contract quote currency.
settlement_currency: Currency
The settlement currency.
is_inverse: bool
If the instrument costing is inverse (quantity expressed in quote currency units).
option_kind: OptionKind
The kind of option (PUT | CALL).
strike_price: Price
The option strike price.
activation_ns: UnixNanos
UNIX timestamp (nanoseconds) for contract activation.
expiration_ns: UnixNanos
UNIX timestamp (nanoseconds) for contract expiration.
price_precision: u8
The option contract currency.
size_precision: u8
The trading size decimal precision.
price_increment: Price
The minimum price increment (tick size).
size_increment: Quantity
The minimum size increment.
multiplier: Quantity
The option multiplier.
lot_size: Quantity
The rounded lot unit size (standard/board).
margin_init: Decimal
The initial (order) margin requirement in percentage of order value.
margin_maint: Decimal
The maintenance (position) margin in percentage of position value.
maker_fee: Decimal
The fee rate for liquidity makers as a percentage of order value.
taker_fee: Decimal
The fee rate for liquidity takers as a percentage of order value.
max_quantity: Option<Quantity>
The maximum allowable order quantity.
min_quantity: Option<Quantity>
The minimum allowable order quantity.
max_notional: Option<Money>
The maximum allowable order notional value.
min_notional: Option<Money>
The minimum allowable order notional value.
max_price: Option<Price>
The maximum allowable quoted price.
min_price: Option<Price>
The minimum allowable quoted price.
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 CryptoOption
impl CryptoOption
Sourcepub fn new_checked(
instrument_id: InstrumentId,
raw_symbol: Symbol,
underlying: Currency,
quote_currency: Currency,
settlement_currency: Currency,
is_inverse: bool,
option_kind: OptionKind,
strike_price: Price,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
multiplier: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
max_notional: Option<Money>,
min_notional: Option<Money>,
max_price: Option<Price>,
min_price: Option<Price>,
margin_init: Option<Decimal>,
margin_maint: Option<Decimal>,
maker_fee: Option<Decimal>,
taker_fee: Option<Decimal>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Result<Self>
pub fn new_checked( instrument_id: InstrumentId, raw_symbol: Symbol, underlying: Currency, quote_currency: Currency, settlement_currency: Currency, is_inverse: bool, option_kind: OptionKind, strike_price: Price, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, size_precision: u8, price_increment: Price, size_increment: Quantity, multiplier: Option<Quantity>, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_notional: Option<Money>, min_notional: Option<Money>, max_price: Option<Price>, min_price: Option<Price>, margin_init: Option<Decimal>, margin_maint: Option<Decimal>, maker_fee: Option<Decimal>, taker_fee: Option<Decimal>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Result<Self>
Creates a new CryptoOption
instance with correctness checking.
§Notes
PyO3 requires a Result
type for proper error handling and stacktrace printing in Python.
§Errors
Returns an error if any input validation fails.
Sourcepub fn new(
instrument_id: InstrumentId,
raw_symbol: Symbol,
underlying: Currency,
quote_currency: Currency,
settlement_currency: Currency,
is_inverse: bool,
option_kind: OptionKind,
strike_price: Price,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
multiplier: Option<Quantity>,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
max_notional: Option<Money>,
min_notional: Option<Money>,
max_price: Option<Price>,
min_price: Option<Price>,
margin_init: Option<Decimal>,
margin_maint: Option<Decimal>,
maker_fee: Option<Decimal>,
taker_fee: Option<Decimal>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Self
pub fn new( instrument_id: InstrumentId, raw_symbol: Symbol, underlying: Currency, quote_currency: Currency, settlement_currency: Currency, is_inverse: bool, option_kind: OptionKind, strike_price: Price, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, size_precision: u8, price_increment: Price, size_increment: Quantity, multiplier: Option<Quantity>, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_notional: Option<Money>, min_notional: Option<Money>, max_price: Option<Price>, min_price: Option<Price>, margin_init: Option<Decimal>, margin_maint: Option<Decimal>, maker_fee: Option<Decimal>, taker_fee: Option<Decimal>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Self
Trait Implementations§
Source§impl Clone for CryptoOption
impl Clone for CryptoOption
Source§fn clone(&self) -> CryptoOption
fn clone(&self) -> CryptoOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CryptoOption
impl Debug for CryptoOption
Source§impl<'de> Deserialize<'de> for CryptoOption
impl<'de> Deserialize<'de> for CryptoOption
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 From<CryptoOption> for InstrumentAny
impl From<CryptoOption> for InstrumentAny
Source§fn from(v: CryptoOption) -> InstrumentAny
fn from(v: CryptoOption) -> InstrumentAny
Source§impl Hash for CryptoOption
impl Hash for CryptoOption
Source§impl Instrument for CryptoOption
impl Instrument for CryptoOption
fn into_any(self) -> InstrumentAny
fn id(&self) -> InstrumentId
fn raw_symbol(&self) -> Symbol
fn asset_class(&self) -> AssetClass
fn instrument_class(&self) -> InstrumentClass
fn underlying(&self) -> Option<Ustr>
fn base_currency(&self) -> Option<Currency>
fn quote_currency(&self) -> Currency
fn settlement_currency(&self) -> Currency
fn is_inverse(&self) -> bool
fn isin(&self) -> Option<Ustr>
fn option_kind(&self) -> Option<OptionKind>
fn strike_price(&self) -> Option<Price>
fn activation_ns(&self) -> Option<UnixNanos>
fn expiration_ns(&self) -> Option<UnixNanos>
fn exchange(&self) -> Option<Ustr>
fn price_precision(&self) -> u8
fn size_precision(&self) -> u8
fn price_increment(&self) -> Price
fn size_increment(&self) -> Quantity
fn multiplier(&self) -> Quantity
fn lot_size(&self) -> Option<Quantity>
fn max_quantity(&self) -> Option<Quantity>
fn min_quantity(&self) -> Option<Quantity>
fn max_notional(&self) -> Option<Money>
fn min_notional(&self) -> Option<Money>
fn max_price(&self) -> Option<Price>
fn min_price(&self) -> Option<Price>
fn ts_event(&self) -> UnixNanos
fn ts_init(&self) -> UnixNanos
fn symbol(&self) -> Symbol
fn venue(&self) -> Venue
fn cost_currency(&self) -> Currency
fn is_quanto(&self) -> bool
fn margin_init(&self) -> Decimal
fn margin_maint(&self) -> Decimal
fn maker_fee(&self) -> Decimal
fn taker_fee(&self) -> Decimal
Source§fn make_price(&self, value: f64) -> Price
fn make_price(&self, value: f64) -> Price
Price
from the given value
with the correct price precision for the instrument.Source§fn make_qty(&self, value: f64, round_down: Option<bool>) -> Quantity
fn make_qty(&self, value: f64, round_down: Option<bool>) -> Quantity
Quantity
from the given value
with the correct size precision for the instrument.Source§impl IntoPy<Py<PyAny>> for CryptoOption
impl IntoPy<Py<PyAny>> for CryptoOption
Source§impl<'py> IntoPyObject<'py> for CryptoOption
impl<'py> IntoPyObject<'py> for CryptoOption
Source§type Target = CryptoOption
type Target = CryptoOption
Source§type Output = Bound<'py, <CryptoOption as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <CryptoOption 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 CryptoOption
impl PartialEq for CryptoOption
Source§impl PyClass for CryptoOption
impl PyClass for CryptoOption
Source§impl PyClassImpl for CryptoOption
impl PyClassImpl for CryptoOption
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<CryptoOption>
type ThreadChecker = SendablePyClass<CryptoOption>
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<CryptoOption> for PyClassImplCollector<CryptoOption>
impl PyClassNewTextSignature<CryptoOption> for PyClassImplCollector<CryptoOption>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a CryptoOption
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a CryptoOption
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut CryptoOption
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut CryptoOption
Source§impl PyMethods<CryptoOption> for PyClassImplCollector<CryptoOption>
impl PyMethods<CryptoOption> for PyClassImplCollector<CryptoOption>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for CryptoOption
impl PyTypeInfo for CryptoOption
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
].Source§impl Serialize for CryptoOption
impl Serialize for CryptoOption
Source§impl TryInto<CryptoOption> for InstrumentAny
impl TryInto<CryptoOption> for InstrumentAny
impl Copy for CryptoOption
impl DerefToPyAny for CryptoOption
impl Eq for CryptoOption
Auto Trait Implementations§
impl Freeze for CryptoOption
impl RefUnwindSafe for CryptoOption
impl Send for CryptoOption
impl Sync for CryptoOption
impl Unpin for CryptoOption
impl UnwindSafe for CryptoOption
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
key
and return true
if they are equal.§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
§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