pub struct OKXPositionHistory {Show 23 fields
pub inst_type: OKXInstrumentType,
pub inst_id: Ustr,
pub mgn_mode: OKXMarginMode,
pub type: Ustr,
pub c_time: String,
pub u_time: u64,
pub open_avg_px: String,
pub close_avg_px: Option<String>,
pub pos_id: Option<Ustr>,
pub open_max_pos: Option<String>,
pub close_total_pos: Option<String>,
pub realized_pnl: Option<String>,
pub fee: Option<String>,
pub funding_fee: Option<String>,
pub liq_penalty: Option<String>,
pub pnl: Option<String>,
pub pnl_ratio: Option<String>,
pub pos_side: OKXPositionSide,
pub lever: String,
pub direction: Option<String>,
pub trigger_px: Option<String>,
pub uly: Option<String>,
pub ccy: Option<String>,
}
Expand description
Represents a single historical position record from GET /api/v5/account/positions-history
.
Fields§
§inst_type: OKXInstrumentType
Instrument type (e.g. “SWAP”, “FUTURES”, etc.).
inst_id: Ustr
Instrument ID (e.g. “BTC-USD-SWAP”).
mgn_mode: OKXMarginMode
Margin mode: e.g. “cross”, “isolated”.
type: Ustr
The type of the last close, e.g. “1” (close partially), “2” (close all), etc. See OKX docs for the meaning of each numeric code.
c_time: String
Creation time of the position (Unix timestamp in milliseconds).
u_time: u64
Last update time, Unix timestamp in milliseconds.
open_avg_px: String
Average price of opening position.
close_avg_px: Option<String>
Average price of closing position (if applicable).
pos_id: Option<Ustr>
The position ID.
open_max_pos: Option<String>
Max quantity of the position at open time.
close_total_pos: Option<String>
Cumulative closed volume of the position.
realized_pnl: Option<String>
Realized profit and loss (only for FUTURES/SWAP/OPTION).
fee: Option<String>
Accumulated fee for the position.
funding_fee: Option<String>
Accumulated funding fee (for perpetual swaps).
liq_penalty: Option<String>
Accumulated liquidation penalty. Negative if there was a penalty.
pnl: Option<String>
Profit and loss (realized or unrealized depending on status).
pnl_ratio: Option<String>
PnL ratio.
pos_side: OKXPositionSide
Position side: “long” / “short” / “net”.
lever: String
Leverage used (the JSON field is “lev”, but we rename it in Rust).
direction: Option<String>
Direction: “long” or “short” (only for MARGIN/FUTURES/SWAP/OPTION).
trigger_px: Option<String>
Trigger mark price. Populated if type
indicates liquidation or ADL.
uly: Option<String>
The underlying (e.g. “BTC-USD” for futures or swap).
ccy: Option<String>
Currency (e.g. “BTC”). May or may not appear in all responses.
Trait Implementations§
Source§impl Clone for OKXPositionHistory
impl Clone for OKXPositionHistory
Source§fn clone(&self) -> OKXPositionHistory
fn clone(&self) -> OKXPositionHistory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OKXPositionHistory
impl Debug for OKXPositionHistory
Source§impl<'de> Deserialize<'de> for OKXPositionHistory
impl<'de> Deserialize<'de> for OKXPositionHistory
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>,
Auto Trait Implementations§
impl Freeze for OKXPositionHistory
impl RefUnwindSafe for OKXPositionHistory
impl Send for OKXPositionHistory
impl Sync for OKXPositionHistory
impl Unpin for OKXPositionHistory
impl UnwindSafe for OKXPositionHistory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more