Trait PerpMarketExt

Source
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§

Source

fn funding_fee_amount_per_size( &self, is_long: bool, is_long_collateral: bool, ) -> Result<Self::Num>

Get current funding fee amount per size.

Source

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.

Source

fn validate_open_interest_reserve( &self, prices: &Prices<Self::Num>, is_long: bool, ) -> Result<()>

Validate open interest reserve.

Source

fn min_collateral_factor_for_open_interest( &self, delta: &Self::Signed, is_long: bool, ) -> Result<Self::Num>

Get min collateral factor for open interest.

Source

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.

Source

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.

Implementors§

Source§

impl<M: PerpMarket<DECIMALS>, const DECIMALS: u8> PerpMarketExt<DECIMALS> for M