pub trait PerpMarketExt<const DECIMALS: u8>: PerpMarket<DECIMALS> {
// Provided methods
fn funding_fee_amount_per_size(
&self,
is_long: bool,
is_long_collateral: bool,
) -> Result<Self::Num> { ... }
fn claimable_funding_fee_amount_per_size(
&self,
is_long: bool,
is_long_collateral: bool,
) -> Result<Self::Num> { ... }
fn validate_open_interest_reserve(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
) -> Result<()> { ... }
fn min_collateral_factor_for_open_interest(
&self,
delta: &Self::Signed,
is_long: bool,
) -> Result<Self::Num> { ... }
fn cap_positive_position_price_impact(
&self,
index_token_price: &Price<Self::Num>,
size_delta_usd: &Self::Signed,
impact: &mut Self::Signed,
) -> Result<()> { ... }
fn cap_negative_position_price_impact(
&self,
size_delta_usd: &Self::Signed,
for_liquidations: bool,
impact: &mut Self::Signed,
) -> Result<Self::Num> { ... }
}
Expand description
Extension trait for PerpMarket
.
Provided Methods§
Sourcefn funding_fee_amount_per_size(
&self,
is_long: bool,
is_long_collateral: bool,
) -> Result<Self::Num>
fn funding_fee_amount_per_size( &self, is_long: bool, is_long_collateral: bool, ) -> Result<Self::Num>
Get current funding fee amount per size.
Sourcefn claimable_funding_fee_amount_per_size(
&self,
is_long: bool,
is_long_collateral: bool,
) -> Result<Self::Num>
fn claimable_funding_fee_amount_per_size( &self, is_long: bool, is_long_collateral: bool, ) -> Result<Self::Num>
Get current claimable funding fee amount per size.
Sourcefn validate_open_interest_reserve(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
) -> Result<()>
fn validate_open_interest_reserve( &self, prices: &Prices<Self::Num>, is_long: bool, ) -> Result<()>
Validate open interest reserve.
Sourcefn min_collateral_factor_for_open_interest(
&self,
delta: &Self::Signed,
is_long: bool,
) -> Result<Self::Num>
fn min_collateral_factor_for_open_interest( &self, delta: &Self::Signed, is_long: bool, ) -> Result<Self::Num>
Get min collateral factor for open interest.
Sourcefn cap_positive_position_price_impact(
&self,
index_token_price: &Price<Self::Num>,
size_delta_usd: &Self::Signed,
impact: &mut Self::Signed,
) -> Result<()>
fn cap_positive_position_price_impact( &self, index_token_price: &Price<Self::Num>, size_delta_usd: &Self::Signed, impact: &mut Self::Signed, ) -> Result<()>
Caps positive position price impact in-place.
If impact
is not positive, the function does nothing.
Sourcefn cap_negative_position_price_impact(
&self,
size_delta_usd: &Self::Signed,
for_liquidations: bool,
impact: &mut Self::Signed,
) -> Result<Self::Num>
fn cap_negative_position_price_impact( &self, size_delta_usd: &Self::Signed, for_liquidations: bool, impact: &mut Self::Signed, ) -> Result<Self::Num>
Caps negative position price impact in-place.
If impact
is not negative, the function does nothing.
§Returns
- The capped amount of the negative
impact
.