pub struct Position {Show 26 fields
pub instrument_name: String,
pub size: f64,
pub direction: Direction,
pub average_price: f64,
pub average_price_usd: Option<f64>,
pub delta: Option<f64>,
pub estimated_liquidation_price: Option<f64>,
pub floating_profit_loss: Option<f64>,
pub floating_profit_loss_usd: Option<f64>,
pub gamma: Option<f64>,
pub index_price: Option<f64>,
pub initial_margin: Option<f64>,
pub interest_value: Option<f64>,
pub kind: Option<String>,
pub leverage: Option<i32>,
pub maintenance_margin: Option<f64>,
pub mark_price: Option<f64>,
pub open_orders_margin: Option<f64>,
pub realized_funding: Option<f64>,
pub realized_profit_loss: Option<f64>,
pub settlement_price: Option<f64>,
pub size_currency: Option<f64>,
pub theta: Option<f64>,
pub total_profit_loss: Option<f64>,
pub vega: Option<f64>,
pub unrealized_profit_loss: Option<f64>,
}Expand description
Trading position structure
Represents a trading position with all associated metrics including size, direction, prices, margins, and Greeks for options.
Fields§
§instrument_name: StringName of the instrument (e.g., “BTC-PERPETUAL”)
size: f64Position size (positive for long, negative for short)
direction: DirectionDirection of the position (buy/sell)
average_price: f64Average entry price of the position
average_price_usd: Option<f64>Average price in USD
delta: Option<f64>Delta (price sensitivity) of the position
estimated_liquidation_price: Option<f64>Estimated liquidation price
floating_profit_loss: Option<f64>Floating (unrealized) profit/loss
floating_profit_loss_usd: Option<f64>Floating profit/loss in USD
gamma: Option<f64>Gamma (delta sensitivity) of the position
index_price: Option<f64>Current index price
initial_margin: Option<f64>Initial margin requirement
interest_value: Option<f64>Interest value
kind: Option<String>Instrument kind (future, option, etc.)
leverage: Option<i32>Leverage used for the position
maintenance_margin: Option<f64>Maintenance margin requirement
mark_price: Option<f64>Current mark price
open_orders_margin: Option<f64>Margin used by open orders
realized_funding: Option<f64>Realized funding payments
realized_profit_loss: Option<f64>Realized profit/loss
settlement_price: Option<f64>Settlement price
size_currency: Option<f64>Position size in currency units
theta: Option<f64>Theta (time decay) of the position
total_profit_loss: Option<f64>Total profit/loss
vega: Option<f64>Vega (volatility sensitivity) of the position
unrealized_profit_loss: Option<f64>Unrealized profit/loss
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>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.