pub struct Position {Show 35 fields
pub position_idx: PositionIdx,
pub risk_id: i64,
pub risk_limit_value: Option<Decimal>,
pub symbol: String,
pub side: Option<Side>,
pub size: Decimal,
pub avg_price: Decimal,
pub position_value: Option<Decimal>,
pub auto_add_margin: bool,
pub position_status: PositionStatus,
pub leverage: Decimal,
pub mark_price: Decimal,
pub liq_price: Option<Decimal>,
pub position_im: Option<Decimal>,
pub position_im_by_mp: Option<Decimal>,
pub position_mm: Option<Decimal>,
pub position_mm_by_mp: Option<Decimal>,
pub take_profit: Option<Decimal>,
pub stop_loss: Option<Decimal>,
pub trailing_stop: Option<Decimal>,
pub session_avg_price: Option<Decimal>,
pub delta: Option<String>,
pub gamma: Option<String>,
pub vega: Option<String>,
pub theta: Option<String>,
pub unrealised_pnl: Option<Decimal>,
pub cur_realised_pnl: Decimal,
pub cum_realised_pnl: Decimal,
pub adl_rank_indicator: AdlRankIndicator,
pub created_time: Timestamp,
pub updated_time: Timestamp,
pub seq: i64,
pub is_reduce_only: bool,
pub mmr_sys_updated_time: Option<Timestamp>,
pub leverage_sys_updated_time: Option<Timestamp>,
}Fields§
§position_idx: PositionIdxPosition idx, used to identify positions in different position modes 0: One-Way Mode 1: Buy side of both side mode 2: Sell side of both side mode
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
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, always positive
avg_price: DecimalAverage entry price For USDC Perp & Futures, it indicates average entry price, and it will not be changed with 8-hour session settlement
position_value: Option<Decimal>Position value
auto_add_margin: boolWhether to add margin automatically when using isolated margin mode 0: false 1: true
position_status: PositionStatusPosition status. Normal, Liq, Adl
leverage: DecimalPosition leverage for portfolio margin mode, this field returns “”, which means leverage rules are invalid
mark_price: DecimalMark price
liq_price: Option<Decimal>Position liquidation price UTA2.0(isolated margin), UTA1.0(isolated margin), UTA1.0(inverse), Classic account: it is the real price for isolated and cross positions, and keeps “” when liqPrice <= minPrice or liqPrice >= maxPrice UTA2.0(Cross margin), UTA1.0(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
position_im: Option<Decimal>Initial margin Classic & UTA1.0(inverse): ignore this field UTA portfolio margin mode, it returns “”
position_im_by_mp: Option<Decimal>Initial margin calculated by mark price Classic & UTA1.0(inverse) : ignore this field UTA portfolio margin mode, it returns “”
position_mm: Option<Decimal>Maintenance margin Classic & UTA1.0(inverse): ignore this field UTA portfolio margin mode, it returns “”
position_mm_by_mp: Option<Decimal>Maintenance margin calculated by mark price Classic & UTA1.0(inverse) : ignore this field UTA portfolio margin mode, it returns “”
take_profit: Option<Decimal>Take profit price
stop_loss: Option<Decimal>Stop loss price
trailing_stop: Option<Decimal>Trailing stop (The distance from market price)
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
unrealised_pnl: Option<Decimal>Unrealised PnL
cur_realised_pnl: DecimalThe realised PnL for the current holding position
cum_realised_pnl: DecimalCumulative realised pnl Futures & Perpetuals: it is the all time cumulative realised P&L Option: always “”, meaningless
adl_rank_indicator: AdlRankIndicatorAuto-deleverage rank indicator. What is Auto-Deleveraging?
created_time: TimestampTimestamp of the first time a position was created on this symbol (ms)
updated_time: TimestampPosition 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 settings like leverage, risk limit
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