pub trait PositionState<const DECIMALS: u8> {
type Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>;
type Signed: UnsignedAbs<Unsigned = Self::Num> + TryFrom<Self::Num> + Num;
// Required methods
fn collateral_amount(&self) -> &Self::Num;
fn size_in_usd(&self) -> &Self::Num;
fn size_in_tokens(&self) -> &Self::Num;
fn borrowing_factor(&self) -> &Self::Num;
fn funding_fee_amount_per_size(&self) -> &Self::Num;
fn claimable_funding_fee_amount_per_size(
&self,
is_long_collateral: bool,
) -> &Self::Num;
}
Expand description
Read-only access to the position state.
Required Associated Types§
Sourcetype Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>
type Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>
Unsigned number type.
Required Methods§
Sourcefn collateral_amount(&self) -> &Self::Num
fn collateral_amount(&self) -> &Self::Num
Get the collateral amount.
Sourcefn size_in_usd(&self) -> &Self::Num
fn size_in_usd(&self) -> &Self::Num
Get a reference to the size (in USD) of the position.
Sourcefn size_in_tokens(&self) -> &Self::Num
fn size_in_tokens(&self) -> &Self::Num
Get a reference to the size (in tokens) of the position.
Sourcefn borrowing_factor(&self) -> &Self::Num
fn borrowing_factor(&self) -> &Self::Num
Get a reference to last borrowing factor applied by the position.
Sourcefn 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.
Sourcefn 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.