#[repr(C)]pub struct PositionState {
pub trade_id: u64,
pub increased_at: i64,
pub updated_at_slot: u64,
pub decreased_at: i64,
pub size_in_tokens: u128,
pub collateral_amount: u128,
pub size_in_usd: u128,
pub borrowing_factor: u128,
pub funding_fee_amount_per_size: u128,
pub long_token_claimable_funding_amount_per_size: u128,
pub short_token_claimable_funding_amount_per_size: u128,
/* private fields */
}
Expand description
Position State.
Fields§
§trade_id: u64
Trade id.
increased_at: i64
The time that the position last increased at.
updated_at_slot: u64
Updated at slot.
decreased_at: i64
The time that the position last decreased at.
size_in_tokens: u128
Size in tokens.
collateral_amount: u128
Collateral amount.
size_in_usd: u128
Size in usd.
borrowing_factor: u128
Borrowing factor.
funding_fee_amount_per_size: u128
Funding fee amount per size.
long_token_claimable_funding_amount_per_size: u128
Long token claimable funding amount per size.
short_token_claimable_funding_amount_per_size: u128
Short token claimable funding amount per size.
Trait Implementations§
Source§impl BorshDeserialize for PositionState
impl BorshDeserialize for PositionState
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for PositionState
impl BorshSerialize for PositionState
Source§impl Clone for PositionState
impl Clone for PositionState
Source§fn clone(&self) -> PositionState
fn clone(&self) -> PositionState
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PositionState
impl Debug for PositionState
Source§impl<'de> Deserialize<'de> for PositionState
impl<'de> Deserialize<'de> for PositionState
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<EventPositionState> for PositionState
impl From<EventPositionState> for PositionState
Source§fn from(event: EventPositionState) -> Self
fn from(event: EventPositionState) -> Self
Converts to this type from the input type.
Source§impl PositionState<{ constants::MARKET_DECIMALS }> for PositionState
impl PositionState<{ constants::MARKET_DECIMALS }> for PositionState
Source§fn collateral_amount(&self) -> &Self::Num
fn collateral_amount(&self) -> &Self::Num
Get the collateral amount.
Source§fn size_in_usd(&self) -> &Self::Num
fn size_in_usd(&self) -> &Self::Num
Get a reference to the size (in USD) of the position.
Source§fn size_in_tokens(&self) -> &Self::Num
fn size_in_tokens(&self) -> &Self::Num
Get a reference to the size (in tokens) of the position.
Source§fn borrowing_factor(&self) -> &Self::Num
fn borrowing_factor(&self) -> &Self::Num
Get a reference to last borrowing factor applied by the position.
Source§fn funding_fee_amount_per_size(&self) -> &Self::Num
fn funding_fee_amount_per_size(&self) -> &Self::Num
Get a reference to the funding fee amount per size.
Source§fn claimable_funding_fee_amount_per_size(
&self,
is_long_collateral: bool,
) -> &Self::Num
fn claimable_funding_fee_amount_per_size( &self, is_long_collateral: bool, ) -> &Self::Num
Get a reference to claimable funding fee amount per size of the given collateral.
Source§impl PositionStateMut<{ constants::MARKET_DECIMALS }> for PositionState
impl PositionStateMut<{ constants::MARKET_DECIMALS }> for PositionState
Source§fn collateral_amount_mut(&mut self) -> &mut Self::Num
fn collateral_amount_mut(&mut self) -> &mut Self::Num
Get a mutable reference to the collateral amount.
Source§fn size_in_usd_mut(&mut self) -> &mut Self::Num
fn size_in_usd_mut(&mut self) -> &mut Self::Num
Get a mutable reference to the size (in USD) of the position.
Source§fn size_in_tokens_mut(&mut self) -> &mut Self::Num
fn size_in_tokens_mut(&mut self) -> &mut Self::Num
Get a mutable reference to the size (in tokens) of the position.
Source§fn borrowing_factor_mut(&mut self) -> &mut Self::Num
fn borrowing_factor_mut(&mut self) -> &mut Self::Num
Get a mutable reference to last borrowing factor applied by the position.
Source§fn funding_fee_amount_per_size_mut(&mut self) -> &mut Self::Num
fn funding_fee_amount_per_size_mut(&mut self) -> &mut Self::Num
Get a mutable reference to the funding fee amount per size.
Source§fn claimable_funding_fee_amount_per_size_mut(
&mut self,
is_long_collateral: bool,
) -> &mut Self::Num
fn claimable_funding_fee_amount_per_size_mut( &mut self, is_long_collateral: bool, ) -> &mut Self::Num
Get a mutable reference to claimable funding fee amount per size of the given collateral.
Source§impl Serialize for PositionState
impl Serialize for PositionState
Source§impl Space for PositionState
impl Space for PositionState
const INIT_SPACE: usize = 272usize
impl Copy for PositionState
impl Pod for PositionState
Auto Trait Implementations§
impl Freeze for PositionState
impl RefUnwindSafe for PositionState
impl Send for PositionState
impl Sync for PositionState
impl Unpin for PositionState
impl UnwindSafe for PositionState
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
Mutably borrows from an owned value. Read more
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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