pub struct Position {
pub market_ticker: String,
pub outcome: String,
pub size: f64,
pub average_price: f64,
pub current_price: f64,
}Expand description
An open position held by the caller.
Fields§
§market_ticker: StringUnified market ticker the position is held on (e.g. "KXBTCD-25APR1517").
outcome: StringOutcome label as published by the exchange (e.g. "Yes", "No").
size: f64Number of contracts held (e.g. 100.0).
average_price: f64Volume-weighted average entry price as YES probability in [0, 1] (e.g. 0.55).
current_price: f64Current mark price as YES probability in [0, 1] (e.g. 0.62).
Implementations§
Source§impl Position
impl Position
pub fn cost_basis(&self) -> f64
pub fn current_value(&self) -> f64
pub fn unrealized_pnl(&self) -> f64
pub fn unrealized_pnl_percent(&self) -> f64
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Position
impl<'de> Deserialize<'de> for Position
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more