Skip to main content

PositionUpdate

Struct PositionUpdate 

Source
#[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

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§inst_type: String

Instrument type, e.g., MARGIN, SWAP, FUTURES, OPTION.

§mgn_mode: String

Margin mode: cross or isolated.

§pos_id: String

OKX-assigned position ID.

§pos_side: String

Position side: long, short, or net.

§pos: NumberString

Position quantity (contracts for derivatives; base currency for margin).

§pos_ccy: String

Position currency (base currency for MARGIN positions only).

§avail_pos: NumberString

Available position (not frozen by closing orders).

§avg_px: NumberString

Average entry price of the position.

§non_settle_avg_px: NumberString

Non-settlement average entry price (cross FUTURES only).

§upl: NumberString

Unrealized profit and loss.

§upl_ratio: NumberString

Unrealized profit and loss ratio.

§upl_last_px: NumberString

Unrealized PnL calculated using the last traded price.

§upl_ratio_last_px: NumberString

Unrealized PnL ratio calculated using the last traded price.

§lever: NumberString

Leverage.

§liq_px: NumberString

Estimated liquidation price.

§mark_px: NumberString

Mark price.

§imr: NumberString

Initial margin requirement in USD.

§margin: NumberString

Margin balance (isolated mode only).

§mgn_ratio: NumberString

Margin ratio.

§mmr: NumberString

Maintenance margin requirement in USD.

§liab: NumberString

Liabilities of the position (for cross-margin positions).

§liab_ccy: String

Liability currency.

§interest: NumberString

Accrued interest.

§usd_px: NumberString

USD price of the instrument’s settlement currency.

§hedged_pos: NumberString

Quantity of base currency hedged via spot (Portfolio margin mode only).

§trade_id: String

Trade ID of the most recent fill for this position.

§opt_val: NumberString

Options value in USD (options positions only).

§pending_close_ord_liab_val: NumberString

Pending closing-order liability value.

§notional_usd: NumberString

Notional value of the position in USD.

§adl: String

Auto-deleveraging (ADL) indicator level (1–5); higher means higher ADL risk.

§ccy: String

Settlement or margin currency of the position.

§last: NumberString

Last traded price.

§idx_px: NumberString

Index price.

§be_px: NumberString

Breakeven price.

§delta_bs: NumberString

Black-Scholes delta (options only).

§delta_pa: NumberString

PA delta (options only).

§gamma_bs: NumberString

Black-Scholes gamma (options only).

§gamma_pa: NumberString

PA gamma (options only).

§theta_bs: NumberString

Black-Scholes theta (options only).

§theta_pa: NumberString

PA theta (options only).

§vega_bs: NumberString

Black-Scholes vega (options only).

§vega_pa: NumberString

PA vega (options only).

§spot_in_use_amt: NumberString

Spot quantity used for hedging (Portfolio margin mode only).

§spot_in_use_ccy: String

Currency of the spot hedge quantity.

§cl_spot_in_use_amt: NumberString

User-defined spot hedge amount.

§max_spot_in_use_amt: NumberString

Maximum spot hedge amount calculated by OKX.

§biz_ref_id: String

External business reference ID (e.g., copy-trading).

§biz_ref_type: String

External business reference type.

§inst_id: String

Instrument ID, e.g., BTC-USDT-SWAP.

§c_time: NumberString

Position creation time (Unix milliseconds).

§u_time: NumberString

Last update time (Unix milliseconds).

§p_time: NumberString

Push time (Unix milliseconds).

§realized_pnl: NumberString

Realized profit and loss.

realizedPnl = pnl + fee + fundingFee + liqPenalty + settledPnl

Only applicable to FUTURES/SWAP/OPTION.

§pnl: NumberString

Accumulated PnL from closing orders, excluding fees.

§fee: NumberString

Accumulated transaction fee. Negative = fee charged; positive = rebate.

§funding_fee: NumberString

Accumulated funding fee.

§liq_penalty: NumberString

Accumulated liquidation penalty (negative when non-zero).

§settled_pnl: NumberString

Accumulated 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: ExtraFields

Unrecognized fields retained for forward compatibility.

Trait Implementations§

Source§

impl Clone for PositionUpdate

Source§

fn clone(&self) -> PositionUpdate

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 PositionUpdate

Source§

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

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

impl Default for PositionUpdate

Source§

fn default() -> PositionUpdate

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PositionUpdate

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§

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