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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<const DECIMALS: u8, P: PositionState<DECIMALS>> PositionState<DECIMALS> for &mut P
impl<const DECIMALS: u8, P: PositionState<DECIMALS>> PositionState<DECIMALS> for &mut P
type Num = <P as PositionState<DECIMALS>>::Num
type Signed = <P as PositionState<DECIMALS>>::Signed
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
Implementors§
Source§impl<T, const DECIMALS: u8> PositionState<DECIMALS> for TestPositionOps<'_, T, DECIMALS>
Available on crate features test only.
impl<T, const DECIMALS: u8> PositionState<DECIMALS> for TestPositionOps<'_, T, DECIMALS>
Available on crate features
test only.