Trait options_common::GenericPosition [−][src]
pub trait GenericPosition {}Show methods
fn symbol(&self) -> &str; fn underlying_symbol(&self) -> &str; fn is_long(&self) -> bool; fn unit_cost(&self) -> Option<Rational64>; fn unit_cost_mut(&mut self) -> &mut Option<Rational64>; fn unit_bid_price(&self) -> Option<Rational64>; fn unit_bid_price_mut(&mut self) -> &mut Option<Rational64>; fn unit_ask_price(&self) -> Option<Rational64>; fn unit_ask_price_mut(&mut self) -> &mut Option<Rational64>; fn unit_delta(&self) -> Option<NotNan<f64>>; fn unit_vega(&self) -> Option<NotNan<f64>>; fn unit_theta(&self) -> Option<NotNan<f64>>; fn quantity(&self) -> usize; fn quantity_mut(&mut self) -> &mut usize; fn equivalent_strike_price(&self) -> Rational64; fn equivalent_option_type(&self) -> OptionType; fn equivalent_lot_size(&self) -> usize; fn signed_quantity(&self) -> i64 { ... } fn cost(&self) -> Option<Rational64> { ... } fn net_liq(&self) -> Option<Rational64> { ... } fn bid_price(&self) -> Option<Rational64> { ... } fn ask_price(&self) -> Option<Rational64> { ... } fn mid_price(&self) -> Option<Rational64> { ... } fn unit_mid_price(&self) -> Option<Rational64> { ... } fn delta(&self) -> Option<NotNan<f64>> { ... } fn vega(&self) -> Option<NotNan<f64>> { ... } fn theta(&self) -> Option<NotNan<f64>> { ... } fn profit_at_expiry(&self, underlying_price: Rational64) -> Rational64 { ... }
Expand description
Defines methods that are shared between option and share positions.
Required methods
For an option position, the symbol of the option itself. For a share position, equal to Self::underlying_symbol()
.
fn underlying_symbol(&self) -> &str
fn underlying_symbol(&self) -> &str
For an option position, the symbol of the instrument that the option is a derivative of. For a share position, the symbol of the stock.
fn unit_cost(&self) -> Option<Rational64>
fn unit_cost(&self) -> Option<Rational64>
The original cost per option contract or share in this position. If the position is long, this should be negative.
fn unit_cost_mut(&mut self) -> &mut Option<Rational64>
fn unit_bid_price(&self) -> Option<Rational64>
fn unit_bid_price(&self) -> Option<Rational64>
The current bid price per option contract or share in this position. If the position is long, this should be positive.
fn unit_bid_price_mut(&mut self) -> &mut Option<Rational64>
fn unit_ask_price(&self) -> Option<Rational64>
fn unit_ask_price(&self) -> Option<Rational64>
The current ask price per option contract or share in this position. If the position is long, this should be positive.
fn unit_ask_price_mut(&mut self) -> &mut Option<Rational64>
fn unit_delta(&self) -> Option<NotNan<f64>>
fn unit_delta(&self) -> Option<NotNan<f64>>
The delta per option contract or share in this position.
The vega per option contract or share in this position.
fn unit_theta(&self) -> Option<NotNan<f64>>
fn unit_theta(&self) -> Option<NotNan<f64>>
The theta per option contract in this position.
fn quantity_mut(&mut self) -> &mut usize
fn equivalent_strike_price(&self) -> Rational64
fn equivalent_strike_price(&self) -> Rational64
For an option position, the strike price of the option. For a share position, the strike price of the call option with the equivalent cost at the time of purchase i.e. $0.
fn equivalent_option_type(&self) -> OptionType
fn equivalent_option_type(&self) -> OptionType
For an option position, the type of the option. For a share position, equal to OptionType::Call
.
fn equivalent_lot_size(&self) -> usize
fn equivalent_lot_size(&self) -> usize
For an option position, the number of units of the underlying per option contract. For a share position, equal to 1.
Provided methods
fn signed_quantity(&self) -> i64
fn signed_quantity(&self) -> i64
Equal to Self::quantity()
, but negative if the position is short.
fn cost(&self) -> Option<Rational64>
fn cost(&self) -> Option<Rational64>
The total original cost of all option contracts or shares in this position.
fn net_liq(&self) -> Option<Rational64>
fn bid_price(&self) -> Option<Rational64>
fn bid_price(&self) -> Option<Rational64>
The total current bid price for all option contracts or shares in this position.
fn ask_price(&self) -> Option<Rational64>
fn ask_price(&self) -> Option<Rational64>
The total current ask price for all option contracts or shares in this position.
fn mid_price(&self) -> Option<Rational64>
fn mid_price(&self) -> Option<Rational64>
The total current mid price for all option contracts or shares in this position.
fn unit_mid_price(&self) -> Option<Rational64>
fn unit_mid_price(&self) -> Option<Rational64>
The current mid price per option contract or share in this position. If the position is long, this will be positive.
The total delta for all option contracts or shares in this position.
The total vega for all option contracts or shares in this position.
The total theta for all option contracts or shares in this position.
fn profit_at_expiry(&self, underlying_price: Rational64) -> Rational64