Position

Struct Position 

Source
pub struct Position<'a> {
Show 27 fields pub category: Option<&'a str>, pub symbol: &'a str, pub side: &'a str, pub size: &'a str, pub position_idx: u8, pub trade_mode: u8, pub position_value: &'a str, pub risk_id: u16, pub risk_limit_value: &'a str, pub entry_price: &'a str, pub mark_price: &'a str, pub leverage: &'a str, pub position_balance: Option<&'a str>, pub auto_add_margin: Option<u8>, pub position_mm: &'a str, pub position_im: &'a str, pub liq_price: &'a str, pub bust_price: &'a str, pub tpsl_mode: &'a str, pub take_profit: &'a str, pub stop_loss: &'a str, pub trailing_stop: &'a str, pub unrealised_pnl: &'a str, pub cum_realised_pnl: &'a str, pub position_status: &'a str, pub created_time: &'a str, pub updated_time: &'a str,
}
Expand description

The position data.

Fields§

§category: Option<&'a str>

Product type.

  • Unified account: does not have this field.
  • Normal account: linear, inverse.
§symbol: &'a str

Symbol name.

§side: &'a str

Position side: Buy, Sell.

§size: &'a str

Position size.

§position_idx: u8

Used to identify positions in different position modes.

  • 0 one-way mode position.
  • 1 Buy side of hedge-mode position.
  • 2 Sell side of hedge-mode position.
§trade_mode: u8

Trade mode. 0: cross margin, 1: isolated margin. Always 0 under unified margin account.

§position_value: &'a str

Position value.

§risk_id: u16

Risk limit ID. Note: for portfolio margin mode, it returns 0, which the risk limit value is invalid.

§risk_limit_value: &'a str

Risk limit value corresponding to riskId. Note: for portfolio margin mode, it returns “”, which the risk limit value is invalid.

§entry_price: &'a str

Entry price.

§mark_price: &'a str

Mark price

§leverage: &'a str

Leverage. Note: for portfolio margin mode, it returns “”, which the leverage value is invalid.

§position_balance: Option<&'a str>

Position margin. Unified account does not have this field.

§auto_add_margin: Option<u8>

Whether to add margin automatically. 0: false, 1: true. Unified account does not have this field.

§position_mm: &'a str

Position maintenance margin. Note: for portfolio margin mode, it returns “”.

§position_im: &'a str

Position initial margin. Note: for portfolio margin mode, it returns “”.

§liq_price: &'a str

Est.liquidation price. “” for Unified trade(spot/linear/options).

§bust_price: &'a str

Est.bankruptcy price. “” for Unified trade(spot/linear/options).

§tpsl_mode: &'a str

Tp/Sl mode: Full, Partial.

§take_profit: &'a str

Take profit price.

§stop_loss: &'a str

Stop loss price.

§trailing_stop: &'a str

Trailing stop.

§unrealised_pnl: &'a str

Unrealised profit and loss.

§cum_realised_pnl: &'a str

Cumulative realised PnL.

§position_status: &'a str

Position status. -Normal.

  • Liq: in the liquidation progress.
  • Adl: in the auto-deleverage progress.
§created_time: &'a str

Position created timestamp (ms).

§updated_time: &'a str

Position data updated timestamp (ms).

Trait Implementations§

Source§

impl<'a> Debug for Position<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de: 'a, 'a> Deserialize<'de> for Position<'a>

Source§

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<'a> Freeze for Position<'a>

§

impl<'a> RefUnwindSafe for Position<'a>

§

impl<'a> Send for Position<'a>

§

impl<'a> Sync for Position<'a>

§

impl<'a> Unpin for Position<'a>

§

impl<'a> UnwindSafe for Position<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,