#[repr(C)]pub struct OptionContract {Show 28 fields
pub id: InstrumentId,
pub raw_symbol: Symbol,
pub asset_class: AssetClass,
pub exchange: Option<Ustr>,
pub underlying: Ustr,
pub option_kind: OptionKind,
pub strike_price: Price,
pub activation_ns: UnixNanos,
pub expiration_ns: UnixNanos,
pub currency: Currency,
pub price_precision: u8,
pub price_increment: Price,
pub size_increment: Quantity,
pub size_precision: u8,
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_price: Option<Price>,
pub min_price: Option<Price>,
pub tick_scheme: Option<Ustr>,
pub info: Option<Params>,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}Expand description
Represents a generic option contract instrument.
Fields§
§id: InstrumentIdThe instrument ID.
raw_symbol: SymbolThe raw/local/native symbol for the instrument, assigned by the venue.
asset_class: AssetClassThe option contract asset class.
exchange: Option<Ustr>The exchange ISO 10383 Market Identifier Code (MIC) where the instrument trades.
underlying: UstrThe underlying asset.
option_kind: OptionKindThe kind of option (PUT | CALL).
strike_price: PriceThe option strike price.
activation_ns: UnixNanosUNIX timestamp (nanoseconds) for contract activation.
expiration_ns: UnixNanosUNIX timestamp (nanoseconds) for contract expiration.
currency: CurrencyThe option contract currency.
price_precision: u8The price decimal precision.
price_increment: PriceThe minimum price increment (tick size).
size_increment: QuantityThe minimum size increment.
size_precision: u8The trading size decimal precision.
multiplier: QuantityThe option multiplier.
lot_size: QuantityThe rounded lot unit size (standard/board).
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.
max_quantity: Option<Quantity>The maximum allowable order quantity.
min_quantity: Option<Quantity>The minimum allowable order quantity.
max_price: Option<Price>The maximum allowable quoted price.
min_price: Option<Price>The minimum allowable quoted price.
tick_scheme: Option<Ustr>The registered variable tick scheme name.
info: Option<Params>Additional instrument metadata as a JSON-serializable dictionary.
ts_event: UnixNanosUNIX timestamp (nanoseconds) when the data event occurred.
ts_init: UnixNanosUNIX timestamp (nanoseconds) when the data object was initialized.
Implementations§
Source§impl OptionContract
impl OptionContract
Sourcepub fn new_checked(
instrument_id: InstrumentId,
raw_symbol: Symbol,
asset_class: AssetClass,
exchange: Option<Ustr>,
underlying: Ustr,
option_kind: OptionKind,
strike_price: Price,
currency: Currency,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
price_increment: Price,
multiplier: Quantity,
lot_size: Quantity,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
max_price: Option<Price>,
min_price: Option<Price>,
margin_init: Option<Decimal>,
margin_maint: Option<Decimal>,
maker_fee: Option<Decimal>,
taker_fee: Option<Decimal>,
tick_scheme: Option<Ustr>,
info: Option<Params>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> CorrectnessResult<Self>
pub fn new_checked( instrument_id: InstrumentId, raw_symbol: Symbol, asset_class: AssetClass, exchange: Option<Ustr>, underlying: Ustr, option_kind: OptionKind, strike_price: Price, currency: Currency, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, price_increment: Price, multiplier: Quantity, lot_size: Quantity, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_price: Option<Price>, min_price: Option<Price>, margin_init: Option<Decimal>, margin_maint: Option<Decimal>, maker_fee: Option<Decimal>, taker_fee: Option<Decimal>, tick_scheme: Option<Ustr>, info: Option<Params>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> CorrectnessResult<Self>
Creates a new OptionContract instance with correctness checking.
§Errors
Returns an error if any input validation fails.
§Notes
PyO3 requires a Result type for proper error handling and stacktrace printing in Python.
Sourcepub fn new(
instrument_id: InstrumentId,
raw_symbol: Symbol,
asset_class: AssetClass,
exchange: Option<Ustr>,
underlying: Ustr,
option_kind: OptionKind,
strike_price: Price,
currency: Currency,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
price_increment: Price,
multiplier: Quantity,
lot_size: Quantity,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
max_price: Option<Price>,
min_price: Option<Price>,
margin_init: Option<Decimal>,
margin_maint: Option<Decimal>,
maker_fee: Option<Decimal>,
taker_fee: Option<Decimal>,
tick_scheme: Option<Ustr>,
info: Option<Params>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Self
pub fn new( instrument_id: InstrumentId, raw_symbol: Symbol, asset_class: AssetClass, exchange: Option<Ustr>, underlying: Ustr, option_kind: OptionKind, strike_price: Price, currency: Currency, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, price_increment: Price, multiplier: Quantity, lot_size: Quantity, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_price: Option<Price>, min_price: Option<Price>, margin_init: Option<Decimal>, margin_maint: Option<Decimal>, maker_fee: Option<Decimal>, taker_fee: Option<Decimal>, tick_scheme: Option<Ustr>, info: Option<Params>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Self
Creates a new OptionContract instance.
§Panics
Panics if any input parameter is invalid (see new_checked).
Sourcepub fn build_checked(
instrument_id: InstrumentId,
raw_symbol: Symbol,
asset_class: AssetClass,
exchange: Option<Ustr>,
underlying: Ustr,
option_kind: OptionKind,
strike_price: Price,
currency: Currency,
activation_ns: UnixNanos,
expiration_ns: UnixNanos,
price_precision: u8,
price_increment: Price,
multiplier: Quantity,
lot_size: Quantity,
max_quantity: Option<Quantity>,
min_quantity: Option<Quantity>,
max_price: Option<Price>,
min_price: Option<Price>,
margin_init: Option<Decimal>,
margin_maint: Option<Decimal>,
maker_fee: Option<Decimal>,
taker_fee: Option<Decimal>,
tick_scheme: Option<Ustr>,
info: Option<Params>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> CorrectnessResult<Self>
pub fn build_checked( instrument_id: InstrumentId, raw_symbol: Symbol, asset_class: AssetClass, exchange: Option<Ustr>, underlying: Ustr, option_kind: OptionKind, strike_price: Price, currency: Currency, activation_ns: UnixNanos, expiration_ns: UnixNanos, price_precision: u8, price_increment: Price, multiplier: Quantity, lot_size: Quantity, max_quantity: Option<Quantity>, min_quantity: Option<Quantity>, max_price: Option<Price>, min_price: Option<Price>, margin_init: Option<Decimal>, margin_maint: Option<Decimal>, maker_fee: Option<Decimal>, taker_fee: Option<Decimal>, tick_scheme: Option<Ustr>, info: Option<Params>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> CorrectnessResult<Self>
Returns a fluent builder for a OptionContract instance.
Required fields are enforced at compile time; optional fields can be omitted and default
the same way they do in OptionContract::new_checked, which the builder calls so the same
correctness checks run on build.
§Errors
Returns an error if any input validation fails (see OptionContract::new_checked).
Sourcepub fn builder() -> OptionContractBuildCheckedBuilder
pub fn builder() -> OptionContractBuildCheckedBuilder
Returns a fluent builder for a OptionContract instance.
Required fields are enforced at compile time; optional fields can be omitted and default
the same way they do in OptionContract::new_checked, which the builder calls so the same
correctness checks run on build.
§Errors
Returns an error if any input validation fails (see OptionContract::new_checked).
Trait Implementations§
Source§impl Clone for OptionContract
impl Clone for OptionContract
Source§fn clone(&self) -> OptionContract
fn clone(&self) -> OptionContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OptionContract
impl Debug for OptionContract
Source§impl<'de> Deserialize<'de> for OptionContract
impl<'de> Deserialize<'de> for OptionContract
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>,
impl Eq for OptionContract
Source§impl From<OptionContract> for InstrumentAny
impl From<OptionContract> for InstrumentAny
Source§fn from(v: OptionContract) -> InstrumentAny
fn from(v: OptionContract) -> InstrumentAny
Source§impl Hash for OptionContract
impl Hash for OptionContract
Source§impl Instrument for OptionContract
impl Instrument for OptionContract
fn tick_scheme(&self) -> Option<Ustr>
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 option_kind(&self) -> Option<OptionKind>
fn exchange(&self) -> Option<Ustr>
fn strike_price(&self) -> Option<Price>
fn activation_ns(&self) -> Option<UnixNanos>
fn expiration_ns(&self) -> Option<UnixNanos>
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_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 margin_init(&self) -> Decimal
fn margin_maint(&self) -> Decimal
fn maker_fee(&self) -> Decimal
fn taker_fee(&self) -> Decimal
fn tick_scheme_rule(&self) -> Option<&dyn TickSchemeRule>
fn symbol(&self) -> Symbol
fn venue(&self) -> Venue
Source§fn cost_currency(&self) -> Currency
fn cost_currency(&self) -> Currency
fn strategy_type(&self) -> Option<Ustr>
fn has_expiration(&self) -> bool
fn allows_negative_price(&self) -> bool
fn is_quanto(&self) -> bool
fn min_price_increment_precision(&self) -> u8
fn min_size_increment_precision(&self) -> u8
Source§fn try_normalize_price(&self, price: Price) -> CorrectnessResult<Price>
fn try_normalize_price(&self, price: Price) -> CorrectnessResult<Price>
price rebuilt with the instrument precision when it is on the price grid. Read moreSource§fn try_make_qty_from_decimal(
&self,
value: Decimal,
round_down: Option<bool>,
) -> Result<Quantity>
fn try_make_qty_from_decimal( &self, value: Decimal, round_down: Option<bool>, ) -> Result<Quantity>
Source§fn make_qty_from_decimal(
&self,
value: Decimal,
round_down: Option<bool>,
) -> Quantity
fn make_qty_from_decimal( &self, value: Decimal, round_down: Option<bool>, ) -> Quantity
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>
Source§fn try_normalize_qty(&self, quantity: Quantity) -> CorrectnessResult<Quantity>
fn try_normalize_qty(&self, quantity: Quantity) -> CorrectnessResult<Quantity>
quantity rebuilt with the instrument precision when it is on the size grid. Read moreSource§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>
Source§fn calculate_base_quantity(
&self,
quantity: Quantity,
last_price: Price,
) -> Quantity
fn calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Quantity
Source§fn try_calculate_notional_value(
&self,
quantity: Quantity,
price: Price,
use_quote_for_inverse: Option<bool>,
) -> Result<Money>
fn try_calculate_notional_value( &self, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Result<Money>
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 PartialEq for OptionContract
impl PartialEq for OptionContract
Source§impl Serialize for OptionContract
impl Serialize for OptionContract
Source§impl TryInto<OptionContract> for InstrumentAny
impl TryInto<OptionContract> for InstrumentAny
Auto Trait Implementations§
impl Freeze for OptionContract
impl RefUnwindSafe for OptionContract
impl Send for OptionContract
impl Sync for OptionContract
impl Unpin for OptionContract
impl UnsafeUnpin for OptionContract
impl UnwindSafe for OptionContract
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.