#[non_exhaustive]pub struct PositionUpdate {Show 60 fields
pub inst_type: String,
pub mgn_mode: String,
pub pos_id: String,
pub pos_side: String,
pub pos: NumberString,
pub pos_ccy: String,
pub avail_pos: NumberString,
pub avg_px: NumberString,
pub non_settle_avg_px: NumberString,
pub upl: NumberString,
pub upl_ratio: NumberString,
pub upl_last_px: NumberString,
pub upl_ratio_last_px: NumberString,
pub lever: NumberString,
pub liq_px: NumberString,
pub mark_px: NumberString,
pub imr: NumberString,
pub margin: NumberString,
pub mgn_ratio: NumberString,
pub mmr: NumberString,
pub liab: NumberString,
pub liab_ccy: String,
pub interest: NumberString,
pub usd_px: NumberString,
pub hedged_pos: NumberString,
pub trade_id: String,
pub opt_val: NumberString,
pub pending_close_ord_liab_val: NumberString,
pub notional_usd: NumberString,
pub adl: String,
pub ccy: String,
pub last: NumberString,
pub idx_px: NumberString,
pub be_px: NumberString,
pub delta_bs: NumberString,
pub delta_pa: NumberString,
pub gamma_bs: NumberString,
pub gamma_pa: NumberString,
pub theta_bs: NumberString,
pub theta_pa: NumberString,
pub vega_bs: NumberString,
pub vega_pa: NumberString,
pub spot_in_use_amt: NumberString,
pub spot_in_use_ccy: String,
pub cl_spot_in_use_amt: NumberString,
pub max_spot_in_use_amt: NumberString,
pub biz_ref_id: String,
pub biz_ref_type: String,
pub inst_id: String,
pub c_time: NumberString,
pub u_time: NumberString,
pub p_time: NumberString,
pub realized_pnl: NumberString,
pub pnl: NumberString,
pub fee: NumberString,
pub funding_fee: NumberString,
pub liq_penalty: NumberString,
pub settled_pnl: NumberString,
pub close_order_algo: Vec<CloseOrderAlgo>,
pub extra: ExtraFields,
}Expand description
Private positions channel row.
OKX docs: https://www.okx.com/docs-v5/en/#trading-account-websocket-positions-channel
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.inst_type: StringInstrument type, e.g., MARGIN, SWAP, FUTURES, OPTION.
mgn_mode: StringMargin mode: cross or isolated.
pos_id: StringOKX-assigned position ID.
pos_side: StringPosition side: long, short, or net.
pos: NumberStringPosition quantity (contracts for derivatives; base currency for margin).
pos_ccy: StringPosition currency (base currency for MARGIN positions only).
avail_pos: NumberStringAvailable position (not frozen by closing orders).
avg_px: NumberStringAverage entry price of the position.
non_settle_avg_px: NumberStringNon-settlement average entry price (cross FUTURES only).
upl: NumberStringUnrealized profit and loss.
upl_ratio: NumberStringUnrealized profit and loss ratio.
upl_last_px: NumberStringUnrealized PnL calculated using the last traded price.
upl_ratio_last_px: NumberStringUnrealized PnL ratio calculated using the last traded price.
lever: NumberStringLeverage.
liq_px: NumberStringEstimated liquidation price.
mark_px: NumberStringMark price.
imr: NumberStringInitial margin requirement in USD.
margin: NumberStringMargin balance (isolated mode only).
mgn_ratio: NumberStringMargin ratio.
mmr: NumberStringMaintenance margin requirement in USD.
liab: NumberStringLiabilities of the position (for cross-margin positions).
liab_ccy: StringLiability currency.
interest: NumberStringAccrued interest.
usd_px: NumberStringUSD price of the instrument’s settlement currency.
hedged_pos: NumberStringQuantity of base currency hedged via spot (Portfolio margin mode only).
trade_id: StringTrade ID of the most recent fill for this position.
opt_val: NumberStringOptions value in USD (options positions only).
pending_close_ord_liab_val: NumberStringPending closing-order liability value.
notional_usd: NumberStringNotional value of the position in USD.
adl: StringAuto-deleveraging (ADL) indicator level (1–5); higher means higher ADL risk.
ccy: StringSettlement or margin currency of the position.
last: NumberStringLast traded price.
idx_px: NumberStringIndex price.
be_px: NumberStringBreakeven price.
delta_bs: NumberStringBlack-Scholes delta (options only).
delta_pa: NumberStringPA delta (options only).
gamma_bs: NumberStringBlack-Scholes gamma (options only).
gamma_pa: NumberStringPA gamma (options only).
theta_bs: NumberStringBlack-Scholes theta (options only).
theta_pa: NumberStringPA theta (options only).
vega_bs: NumberStringBlack-Scholes vega (options only).
vega_pa: NumberStringPA vega (options only).
spot_in_use_amt: NumberStringSpot quantity used for hedging (Portfolio margin mode only).
spot_in_use_ccy: StringCurrency of the spot hedge quantity.
cl_spot_in_use_amt: NumberStringUser-defined spot hedge amount.
max_spot_in_use_amt: NumberStringMaximum spot hedge amount calculated by OKX.
biz_ref_id: StringExternal business reference ID (e.g., copy-trading).
biz_ref_type: StringExternal business reference type.
inst_id: StringInstrument ID, e.g., BTC-USDT-SWAP.
c_time: NumberStringPosition creation time (Unix milliseconds).
u_time: NumberStringLast update time (Unix milliseconds).
p_time: NumberStringPush time (Unix milliseconds).
realized_pnl: NumberStringRealized profit and loss.
realizedPnl = pnl + fee + fundingFee + liqPenalty + settledPnl
Only applicable to FUTURES/SWAP/OPTION.
pnl: NumberStringAccumulated PnL from closing orders, excluding fees.
fee: NumberStringAccumulated transaction fee. Negative = fee charged; positive = rebate.
funding_fee: NumberStringAccumulated funding fee.
liq_penalty: NumberStringAccumulated liquidation penalty (negative when non-zero).
settled_pnl: NumberStringAccumulated settled P&L calculated by settlement price.
Only applicable to cross FUTURES.
close_order_algo: Vec<CloseOrderAlgo>Close-position algo orders attached to this position.
Non-empty only after placing an algo order with closeFraction=1.
extra: ExtraFieldsUnrecognized fields retained for forward compatibility.
Trait Implementations§
Source§impl Clone for PositionUpdate
impl Clone for PositionUpdate
Source§fn clone(&self) -> PositionUpdate
fn clone(&self) -> PositionUpdate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more