pub struct DecreasePosition<P, const DECIMALS: u8>where
P: Position<DECIMALS>,{ /* private fields */ }Expand description
Decrease the position.
Implementations§
Source§impl<const DECIMALS: u8, P> DecreasePosition<P, DECIMALS>where
P: PositionMut<DECIMALS>,
<P as Position<DECIMALS>>::Market: PerpMarketMut<DECIMALS, Num = <P as PositionState<DECIMALS>>::Num, Signed = <P as PositionState<DECIMALS>>::Signed>,
impl<const DECIMALS: u8, P> DecreasePosition<P, DECIMALS>where
P: PositionMut<DECIMALS>,
<P as Position<DECIMALS>>::Market: PerpMarketMut<DECIMALS, Num = <P as PositionState<DECIMALS>>::Num, Signed = <P as PositionState<DECIMALS>>::Signed>,
Sourcepub fn try_new(
position: P,
prices: Prices<<P as PositionState<DECIMALS>>::Num>,
size_delta_usd: <P as PositionState<DECIMALS>>::Num,
acceptable_price: Option<<P as PositionState<DECIMALS>>::Num>,
collateral_withdrawal_amount: <P as PositionState<DECIMALS>>::Num,
flags: DecreasePositionFlags,
) -> Result<DecreasePosition<P, DECIMALS>, Error>
pub fn try_new( position: P, prices: Prices<<P as PositionState<DECIMALS>>::Num>, size_delta_usd: <P as PositionState<DECIMALS>>::Num, acceptable_price: Option<<P as PositionState<DECIMALS>>::Num>, collateral_withdrawal_amount: <P as PositionState<DECIMALS>>::Num, flags: DecreasePositionFlags, ) -> Result<DecreasePosition<P, DECIMALS>, Error>
Create a new action to decrease the given position.
Sourcepub fn set_swap(
self,
kind: DecreasePositionSwapType,
) -> DecreasePosition<P, DECIMALS>
pub fn set_swap( self, kind: DecreasePositionSwapType, ) -> DecreasePosition<P, DECIMALS>
Set the swap type.
Sourcepub fn is_full_close(&self) -> bool
pub fn is_full_close(&self) -> bool
Whether the action is a full close.
Trait Implementations§
Source§impl<const DECIMALS: u8, P> MarketAction for DecreasePosition<P, DECIMALS>where
P: PositionMut<DECIMALS>,
<P as Position<DECIMALS>>::Market: PerpMarketMut<DECIMALS, Num = <P as PositionState<DECIMALS>>::Num, Signed = <P as PositionState<DECIMALS>>::Signed>,
impl<const DECIMALS: u8, P> MarketAction for DecreasePosition<P, DECIMALS>where
P: PositionMut<DECIMALS>,
<P as Position<DECIMALS>>::Market: PerpMarketMut<DECIMALS, Num = <P as PositionState<DECIMALS>>::Num, Signed = <P as PositionState<DECIMALS>>::Signed>,
Source§type Report = Box<DecreasePositionReport<<P as PositionState<DECIMALS>>::Num, <P as PositionState<DECIMALS>>::Signed>>
type Report = Box<DecreasePositionReport<<P as PositionState<DECIMALS>>::Num, <P as PositionState<DECIMALS>>::Signed>>
The type of the execution report of the action.
Source§fn execute(
self,
) -> Result<<DecreasePosition<P, DECIMALS> as MarketAction>::Report, Error>
fn execute( self, ) -> Result<<DecreasePosition<P, DECIMALS> as MarketAction>::Report, Error>
Execute.
Auto Trait Implementations§
impl<P, const DECIMALS: u8> Freeze for DecreasePosition<P, DECIMALS>
impl<P, const DECIMALS: u8> RefUnwindSafe for DecreasePosition<P, DECIMALS>
impl<P, const DECIMALS: u8> Send for DecreasePosition<P, DECIMALS>
impl<P, const DECIMALS: u8> Sync for DecreasePosition<P, DECIMALS>
impl<P, const DECIMALS: u8> Unpin for DecreasePosition<P, DECIMALS>
impl<P, const DECIMALS: u8> UnwindSafe for DecreasePosition<P, DECIMALS>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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