pub enum Position {
OptionsPosition(OptionsPosition),
SharesPosition(SharesPosition),
}
Variants§
OptionsPosition(OptionsPosition)
Trait Implementations§
Source§impl From<OptionsPosition> for Position
impl From<OptionsPosition> for Position
Source§fn from(v: OptionsPosition) -> Position
fn from(v: OptionsPosition) -> Position
Source§fn from(v: SharesPosition) -> Position
fn from(v: SharesPosition) -> Position
Source§impl GenericPosition for Position
impl GenericPosition for Position
Source§fn symbol(&self) -> &str
fn symbol(&self) -> &str
For an option position, the symbol of the option itself. For a share position, equal to Self::underlying_symbol()
.
Source§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.
Source§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.
Source§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.
Source§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.
Source§fn unit_delta(&self) -> Option<NotNan<f64>>
fn unit_delta(&self) -> Option<NotNan<f64>>
The delta per option contract or share in this position, where the delta equivalent of 1 share == 0.01.
Source§fn unit_vega(&self) -> Option<NotNan<f64>>
fn unit_vega(&self) -> Option<NotNan<f64>>
The vega per option contract or share in this position.
Source§fn quantity(&self) -> Rational64
fn quantity(&self) -> Rational64
The number of option contracts or shares in this position.
Source§fn signed_quantity(&self) -> Rational64
fn signed_quantity(&self) -> Rational64
Equal to Self::quantity()
, but negative if the position is short.
Source§fn cost(&self) -> Option<Rational64>
fn cost(&self) -> Option<Rational64>
The total original cost of all option contracts or shares in this position.
Source§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.
Source§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.
Source§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.
Source§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.
Source§fn delta(&self) -> Option<NotNan<f64>>
fn delta(&self) -> Option<NotNan<f64>>
The total delta for all option contracts or shares in this position, where the delta equivalent of 1 share == 0.01.
Source§fn vega(&self) -> Option<NotNan<f64>>
fn vega(&self) -> Option<NotNan<f64>>
The total vega for all option contracts or shares in this position.
Source§fn theta(&self) -> Option<NotNan<f64>>
fn theta(&self) -> Option<NotNan<f64>>
The total theta for all option contracts or shares in this position.
Source§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.
Source§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
.
Source§fn equivalent_lot_size(&self) -> i64
fn equivalent_lot_size(&self) -> i64
For an option position, the number of units of the underlying per option contract. For a share position, equal to 1.
fn unit_cost_mut(&mut self) -> &mut Option<Rational64>
fn unit_bid_price_mut(&mut self) -> &mut Option<Rational64>
fn unit_ask_price_mut(&mut self) -> &mut Option<Rational64>
fn quantity_mut(&mut self) -> &mut Rational64
fn net_liq(&self) -> Option<Rational64>
fn profit_at_expiry(&self, __enum_dispatch_arg_0: Rational64) -> Rational64
Source§impl TryInto<OptionsPosition> for Position
impl TryInto<OptionsPosition> for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.