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: CategoryProduct type
symbol: StringSymbol 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: DecimalPosition size
position_idx: PositionIdxUsed to identify positions in different position modes
position_value: DecimalPosition value
risk_id: i64Risk 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: DecimalEntry price
mark_price: DecimalMark price
leverage: DecimalPosition leverage for portfolio margin mode, this field returns “”, which means leverage rules are invalid
auto_add_margin: boolWhether 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: DecimalTake profit price
stop_loss: DecimalStop loss price
trailing_stop: DecimalTrailing stop
unrealised_pnl: DecimalUnrealised profit and loss
cur_realised_pnl: DecimalThe 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: DecimalCumulative 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: PositionStatusPosition status. Normal, Liq, Adl
adl_rank_indicator: AdlRankIndicatorAuto-deleverage rank indicator. What is Auto-Deleveraging?
is_reduce_only: boolUseful 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: TimestampTimestamp of the first time a position was created on this symbol (ms)
updated_time: TimestampPosition data updated timestamp (ms)
seq: i64Cross 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
impl Clone for PositionMsg
Source§fn clone(&self) -> PositionMsg
fn clone(&self) -> PositionMsg
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PositionMsg
impl Debug for PositionMsg
Source§impl<'de> Deserialize<'de> for PositionMsg
impl<'de> Deserialize<'de> for PositionMsg
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>,
Source§impl PartialEq for PositionMsg
impl PartialEq for PositionMsg
Source§fn eq(&self, other: &PositionMsg) -> bool
fn eq(&self, other: &PositionMsg) -> bool
self and other values to be equal, and is used by ==.