pub struct ClosePositionInstructions {
pub pos: Position,
pub capped_exposure: Signed<Collateral>,
pub additional_losses: Collateral,
pub settlement_price: PricePoint,
pub reason: PositionCloseReason,
pub closed_during_liquifunding: bool,
}
Expand description
Instructions to close a position.
Closing a position can occur for multiple reasons: explicit action by the trader, settling price exposure (meaning: you hit a liquidation or take profit), insufficient margin… the point of this data structure is to capture all the information needed by the close position actions to do final settlement on a position and move it to the closed position data structures.
Fields§
§pos: Position
The position in its current state
capped_exposure: Signed<Collateral>
The capped exposure amount after taking liquidation margin into account.
Positive value means a transfer from counter collateral to active collateral. Negative means active to counter collateral. This is not reflected in the position itself, since Position requires non-zero active and counter collateral, and it’s entirely possible we will consume the entirety of one of those fields.
additional_losses: Collateral
Additional losses that the trader experienced that cut into liquidation margin.
If the trader experienced max gains, then this value is 0. In the case where the trader experienced a liquidation event and capped_exposure did not fully represent losses due to liquidation margin, this value contains additional losses we would like to take away from the trader after paying all pending fees.
settlement_price: PricePoint
The price point used for settling this position.
reason: PositionCloseReason
§closed_during_liquifunding: bool
Did this occur because the position was closed during liquifunding?
Trait Implementations§
source§impl Clone for ClosePositionInstructions
impl Clone for ClosePositionInstructions
source§fn clone(&self) -> ClosePositionInstructions
fn clone(&self) -> ClosePositionInstructions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for ClosePositionInstructions
impl Send for ClosePositionInstructions
impl Sync for ClosePositionInstructions
impl Unpin for ClosePositionInstructions
impl UnwindSafe for ClosePositionInstructions
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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> 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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
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