#[repr(C)]pub struct BinaryOption {Show 24 fields
pub id: InstrumentId,
pub raw_symbol: Symbol,
pub asset_class: AssetClass,
pub currency: Currency,
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 margin_init: Decimal,
pub margin_maint: Decimal,
pub maker_fee: Decimal,
pub taker_fee: Decimal,
pub outcome: Option<Ustr>,
pub description: Option<Ustr>,
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 binary option instrument.
Fields§
§id: InstrumentIdThe instrument ID.
raw_symbol: SymbolThe raw/local/native symbol for the instrument, assigned by the venue.
asset_class: AssetClassThe binary option asset class.
currency: CurrencyThe binary option contract currency.
activation_ns: UnixNanosUNIX timestamp (nanoseconds) for contract activation.
expiration_ns: UnixNanosUNIX timestamp (nanoseconds) for contract expiration.
price_precision: u8The price decimal precision.
size_precision: u8The trading size decimal precision.
price_increment: PriceThe minimum price increment (tick size).
size_increment: QuantityThe minimum size increment.
margin_init: DecimalThe initial (order) margin requirement in percentage of order value.
margin_maint: DecimalThe maintenance (position) margin in percentage of position value.
maker_fee: DecimalThe fee rate for liquidity makers as a percentage of order value.
taker_fee: DecimalThe fee rate for liquidity takers as a percentage of order value.
outcome: Option<Ustr>The binary outcome of the market.
description: Option<Ustr>The market description.
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: UnixNanosUNIX timestamp (nanoseconds) when the data event occurred.
ts_init: UnixNanosUNIX timestamp (nanoseconds) when the data object was initialized.
Implementations§
Source§impl BinaryOption
impl BinaryOption
Sourcepub fn new_checked(
instrument_id: InstrumentId,
raw_symbol: Symbol,
asset_class: AssetClass,
currency: Currency,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
outcome: Option<Ustr>,
description: Option<Ustr>,
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, asset_class: AssetClass, currency: Currency, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, size_precision: u8, price_increment: Price, size_increment: Quantity, outcome: Option<Ustr>, description: Option<Ustr>, 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 BinaryOption 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 (e.g., invalid precision or increments).
Sourcepub fn new(
instrument_id: InstrumentId,
raw_symbol: Symbol,
asset_class: AssetClass,
currency: Currency,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
size_precision: u8,
price_increment: Price,
size_increment: Quantity,
outcome: Option<Ustr>,
description: Option<Ustr>,
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, asset_class: AssetClass, currency: Currency, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, size_precision: u8, price_increment: Price, size_increment: Quantity, outcome: Option<Ustr>, description: Option<Ustr>, 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
Creates a new BinaryOption instance by validating parameters.
§Panics
Panics if parameter validation fails during new_checked.
Trait Implementations§
Source§impl Clone for BinaryOption
impl Clone for BinaryOption
Source§fn clone(&self) -> BinaryOption
fn clone(&self) -> BinaryOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BinaryOption
impl Debug for BinaryOption
Source§impl<'de> Deserialize<'de> for BinaryOption
impl<'de> Deserialize<'de> for BinaryOption
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<BinaryOption> for InstrumentAny
impl From<BinaryOption> for InstrumentAny
Source§fn from(v: BinaryOption) -> InstrumentAny
fn from(v: BinaryOption) -> InstrumentAny
Source§impl Hash for BinaryOption
impl Hash for BinaryOption
Source§impl Instrument for BinaryOption
impl Instrument for BinaryOption
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 isin(&self) -> Option<Ustr>
fn exchange(&self) -> Option<Ustr>
fn option_kind(&self) -> Option<OptionKind>
fn is_inverse(&self) -> bool
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_price(&self) -> Option<Price>
fn min_price(&self) -> Option<Price>
fn ts_event(&self) -> UnixNanos
fn ts_init(&self) -> UnixNanos
fn strike_price(&self) -> Option<Price>
fn activation_ns(&self) -> Option<UnixNanos>
fn expiration_ns(&self) -> Option<UnixNanos>
fn max_notional(&self) -> Option<Money>
fn min_notional(&self) -> Option<Money>
fn tick_scheme(&self) -> Option<&dyn TickSchemeRule>
fn symbol(&self) -> Symbol
fn venue(&self) -> Venue
Source§fn cost_currency(&self) -> Currency
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
fn _min_price_increment_precision(&self) -> u8
fn make_price(&self, value: f64) -> Price
Source§fn try_make_qty(&self, value: f64, round_down: Option<bool>) -> Result<Quantity>
fn try_make_qty(&self, value: f64, round_down: Option<bool>) -> Result<Quantity>
fn make_qty(&self, value: f64, round_down: Option<bool>) -> Quantity
Source§fn try_calculate_base_quantity(
&self,
quantity: Quantity,
last_price: Price,
) -> Result<Quantity>
fn try_calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Result<Quantity>
fn calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Quantity
Source§fn calculate_notional_value(
&self,
quantity: Quantity,
price: Price,
use_quote_for_inverse: Option<bool>,
) -> Money
fn calculate_notional_value( &self, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Money
fn next_bid_price(&self, value: f64, n: i32) -> Option<Price>
fn next_ask_price(&self, value: f64, n: i32) -> Option<Price>
fn next_bid_prices(&self, value: f64, n: usize) -> Vec<Price>
fn next_ask_prices(&self, value: f64, n: usize) -> Vec<Price>
Source§impl<'py> IntoPyObject<'py> for BinaryOption
impl<'py> IntoPyObject<'py> for BinaryOption
Source§type Target = BinaryOption
type Target = BinaryOption
Source§type Output = Bound<'py, <BinaryOption as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <BinaryOption 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 BinaryOption
impl PartialEq for BinaryOption
Source§impl PyClass for BinaryOption
impl PyClass for BinaryOption
Source§impl PyClassImpl for BinaryOption
impl PyClassImpl for BinaryOption
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 = /// Represents a generic binary option instrument.
const RAW_DOC: &'static CStr = /// Represents a generic binary option instrument.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<BinaryOption>
type ThreadChecker = SendablePyClass<BinaryOption>
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 for BinaryOption
impl PyClassNewTextSignature for BinaryOption
const TEXT_SIGNATURE: &'static str = "(instrument_id, raw_symbol, asset_class, currency, activation_ns, expiration_ns, price_precision, size_precision, price_increment, size_increment, ts_event, ts_init, outcome=None, description=None, max_quantity=None, min_quantity=None, max_notional=None, min_notional=None, max_price=None, min_price=None, margin_init=None, margin_maint=None, maker_fee=None, taker_fee=None)"
Source§impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder BinaryOption
impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder BinaryOption
Source§impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut BinaryOption
impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut BinaryOption
Source§impl PyMethods<BinaryOption> for PyClassImplCollector<BinaryOption>
impl PyMethods<BinaryOption> for PyClassImplCollector<BinaryOption>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for BinaryOption
impl PyTypeInfo for BinaryOption
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 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_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Source§impl Serialize for BinaryOption
impl Serialize for BinaryOption
Source§impl TryInto<BinaryOption> for InstrumentAny
impl TryInto<BinaryOption> for InstrumentAny
impl Copy for BinaryOption
impl DerefToPyAny for BinaryOption
impl Eq for BinaryOption
Auto Trait Implementations§
impl Freeze for BinaryOption
impl RefUnwindSafe for BinaryOption
impl Send for BinaryOption
impl Sync for BinaryOption
impl Unpin for BinaryOption
impl UnwindSafe for BinaryOption
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<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<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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more§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