Skip to main content

PositionMsg

Struct PositionMsg 

Source
pub struct PositionMsg {
Show 36 fields pub category: Category, pub symbol: String, pub side: Option<Side>, pub size: Decimal, pub position_idx: PositionIdx, pub position_value: Decimal, pub risk_id: i64, pub risk_limit_value: Option<Decimal>, pub entry_price: Decimal, pub mark_price: Decimal, pub leverage: Decimal, pub auto_add_margin: bool, pub position_im: Option<Decimal>, pub position_mm: Option<Decimal>, pub position_im_by_mp: Option<Decimal>, pub position_mm_by_mp: Option<Decimal>, pub liq_price: Option<Decimal>, pub take_profit: Decimal, pub stop_loss: Decimal, pub trailing_stop: Decimal, pub unrealised_pnl: Decimal, pub cur_realised_pnl: Decimal, pub session_avg_price: Option<Decimal>, pub delta: Option<String>, pub gamma: Option<String>, pub vega: Option<String>, pub theta: Option<String>, pub cum_realised_pnl: Decimal, pub position_status: PositionStatus, pub adl_rank_indicator: AdlRankIndicator, pub is_reduce_only: bool, pub mmr_sys_updated_time: Option<Timestamp>, pub leverage_sys_updated_time: Option<Timestamp>, pub created_time: Timestamp, pub updated_time: Timestamp, pub seq: i64,
}

Fields§

§category: Category

Product type

§symbol: String

Symbol name

§side: Option<Side>

Position side. Buy: long, Sell: short one-way mode: classic & UTA1.0(inverse), an empty position returns None. UTA2.0(linear, inverse) & UTA1.0(linear): either one-way or hedge mode returns an empty string “” for an empty position.

§size: Decimal

Position size

§position_idx: PositionIdx

Used to identify positions in different position modes

§position_value: Decimal

Position value

§risk_id: i64

Risk tier ID for portfolio margin mode, this field returns 0, which means risk limit rules are invalid

§risk_limit_value: Option<Decimal>

Risk limit value for portfolio margin mode, this field returns 0, which means risk limit rules are invalid

§entry_price: Decimal

Entry price

§mark_price: Decimal

Mark price

§leverage: Decimal

Position leverage for portfolio margin mode, this field returns “”, which means leverage rules are invalid

§auto_add_margin: bool

Whether to add margin automatically. 0: false, 1: true. For UTA, it is meaningful only when UTA enables ISOLATED_MARGIN

§position_im: Option<Decimal>

Initial margin, the same value as positionIMByMp, please note this change The New Margin Calculation: Adjustments and Implications Portfolio margin mode: returns “”

§position_mm: Option<Decimal>

Maintenance margin, the same value as positionMMByMp Portfolio margin mode: returns “”

§position_im_by_mp: Option<Decimal>

Initial margin calculated by mark price, the same value as positionIM Portfolio margin mode: returns “”

§position_mm_by_mp: Option<Decimal>

Maintenance margin calculated by mark price, the same value as positionMM Portfolio margin mode: returns “”

§liq_price: Option<Decimal>

Position liquidation price Isolated margin: it is the real price for isolated and cross positions, and keeps “” when liqPrice <= minPrice or liqPrice >= maxPrice Cross margin: it is an estimated price for cross positions(because the unified mode controls the risk rate according to the account), and keeps “” when liqPrice <= minPrice or liqPrice >= maxPrice this field is empty for Portfolio Margin Mode, and no liquidation price will be provided

§take_profit: Decimal

Take profit price

§stop_loss: Decimal

Stop loss price

§trailing_stop: Decimal

Trailing stop

§unrealised_pnl: Decimal

Unrealised profit and loss

§cur_realised_pnl: Decimal

The realised PnL for the current holding position

§session_avg_price: Option<Decimal>

USDC contract session avg price, it is the same figure as avg entry price shown in the web UI

§delta: Option<String>

Delta

§gamma: Option<String>

Gamma

§vega: Option<String>

Vega

§theta: Option<String>

Theta

§cum_realised_pnl: Decimal

Cumulative realised pnl Futures & Perp: it is the all time cumulative realised P&L Option: it is the realised P&L when you hold that position

§position_status: PositionStatus

Position status. Normal, Liq, Adl

§adl_rank_indicator: AdlRankIndicator

Auto-deleverage rank indicator. What is Auto-Deleveraging?

§is_reduce_only: bool

Useful when Bybit lower the risk limit true: Only allowed to reduce the position. You can consider a series of measures, e.g., lower the risk limit, decrease leverage or reduce the position, add margin, or cancel orders, after these operations, you can call confirm new risk limit endpoint to check if your position can be removed the reduceOnly mark false: There is no restriction, and it means your position is under the risk when the risk limit is systematically adjusted Only meaningful for isolated margin & cross margin of USDT Perp, USDC Perp, USDC Futures, Inverse Perp and Inverse Futures, meaningless for others

§mmr_sys_updated_time: Option<Timestamp>

Useful when Bybit lower the risk limit When isReduceOnly=true: the timestamp (ms) when the MMR will be forcibly adjusted by the system When isReduceOnly=false: the timestamp when the MMR had been adjusted by system It returns the timestamp when the system operates, and if you manually operate, there is no timestamp Keeps “” by default, if there was a lower risk limit system adjustment previously, it shows that system operation timestamp Only meaningful for isolated margin & cross margin of USDT Perp, USDC Perp, USDC Futures, Inverse Perp and Inverse Futures, meaningless for others

§leverage_sys_updated_time: Option<Timestamp>

Useful when Bybit lower the risk limit When isReduceOnly=true: the timestamp (ms) when the leverage will be forcibly adjusted by the system When isReduceOnly=false: the timestamp when the leverage had been adjusted by system It returns the timestamp when the system operates, and if you manually operate, there is no timestamp Keeps “” by default, if there was a lower risk limit system adjustment previously, it shows that system operation timestamp Only meaningful for isolated margin & cross margin of USDT Perp, USDC Perp, USDC Futures, Inverse Perp and Inverse Futures, meaningless for others

§created_time: Timestamp

Timestamp of the first time a position was created on this symbol (ms)

§updated_time: Timestamp

Position data updated timestamp (ms)

§seq: i64

Cross sequence, used to associate each fill and each position update Different symbols may have the same seq, please use seq + symbol to check unique Returns “-1” if the symbol has never been traded Returns the seq updated by the last transaction when there are setting like leverage, risk limit

Trait Implementations§

Source§

impl Clone for PositionMsg

Source§

fn clone(&self) -> PositionMsg

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PositionMsg

Source§

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

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

impl<'de> Deserialize<'de> for PositionMsg

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PositionMsg

Source§

fn eq(&self, other: &PositionMsg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PositionMsg

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more