Trait BaseMarket

Source
pub trait BaseMarket<const DECIMALS: u8> {
    type Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>;
    type Signed: UnsignedAbs<Unsigned = Self::Num> + TryFrom<Self::Num> + Num;
    type Pool: Pool<Num = Self::Num, Signed = Self::Signed>;

Show 13 methods // Required methods fn liquidity_pool(&self) -> Result<&Self::Pool>; fn claimable_fee_pool(&self) -> Result<&Self::Pool>; fn swap_impact_pool(&self) -> Result<&Self::Pool>; fn open_interest_pool(&self, is_long: bool) -> Result<&Self::Pool>; fn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>; fn collateral_sum_pool(&self, is_long: bool) -> Result<&Self::Pool>; fn usd_to_amount_divisor(&self) -> Self::Num; fn max_pool_amount(&self, is_long_token: bool) -> Result<Self::Num>; fn pnl_factor_config( &self, kind: PnlFactorKind, is_long: bool, ) -> Result<Self::Num>; fn reserve_factor(&self) -> Result<Self::Num>; fn open_interest_reserve_factor(&self) -> Result<Self::Num>; fn max_open_interest(&self, is_long: bool) -> Result<Self::Num>; fn ignore_open_interest_for_usage_factor(&self) -> Result<bool>;
}
Expand description

Base Market trait.

Required Associated Types§

Source

type Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>

Unsigned number type used in the market.

Source

type Signed: UnsignedAbs<Unsigned = Self::Num> + TryFrom<Self::Num> + Num

Signed number type used in the market.

Source

type Pool: Pool<Num = Self::Num, Signed = Self::Signed>

Pool type.

Required Methods§

Source

fn liquidity_pool(&self) -> Result<&Self::Pool>

Get the liquidity pool.

Source

fn claimable_fee_pool(&self) -> Result<&Self::Pool>

Get the claimable fee pool.

Source

fn swap_impact_pool(&self) -> Result<&Self::Pool>

Get the swap impact pool.

Source

fn open_interest_pool(&self, is_long: bool) -> Result<&Self::Pool>

Get the open interest pool.

Source

fn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>

Get the open interest in (index) tokens pool.

Source

fn collateral_sum_pool(&self, is_long: bool) -> Result<&Self::Pool>

Get collateral sum pool.

Source

fn usd_to_amount_divisor(&self) -> Self::Num

USD value to market token amount divisor.

One should make sure it is non-zero.

Source

fn max_pool_amount(&self, is_long_token: bool) -> Result<Self::Num>

Get max pool amount.

Source

fn pnl_factor_config( &self, kind: PnlFactorKind, is_long: bool, ) -> Result<Self::Num>

Get pnl factor config.

Source

fn reserve_factor(&self) -> Result<Self::Num>

Get reserve factor.

Source

fn open_interest_reserve_factor(&self) -> Result<Self::Num>

Get open interest reserve factor.

Source

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

Get max open interest.

Source

fn ignore_open_interest_for_usage_factor(&self) -> Result<bool>

Returns whether ignore open interest for usage factor.

Implementations on Foreign Types§

Source§

impl<M: BaseMarket<DECIMALS>, const DECIMALS: u8> BaseMarket<DECIMALS> for &mut M

Source§

type Num = <M as BaseMarket<DECIMALS>>::Num

Source§

type Signed = <M as BaseMarket<DECIMALS>>::Signed

Source§

type Pool = <M as BaseMarket<DECIMALS>>::Pool

Source§

fn liquidity_pool(&self) -> Result<&Self::Pool>

Source§

fn swap_impact_pool(&self) -> Result<&Self::Pool>

Source§

fn claimable_fee_pool(&self) -> Result<&Self::Pool>

Source§

fn open_interest_pool(&self, is_long: bool) -> Result<&Self::Pool>

Source§

fn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>

Source§

fn collateral_sum_pool(&self, is_long: bool) -> Result<&Self::Pool>

Source§

fn usd_to_amount_divisor(&self) -> Self::Num

Source§

fn max_pool_amount(&self, is_long_token: bool) -> Result<Self::Num>

Source§

fn pnl_factor_config( &self, kind: PnlFactorKind, is_long: bool, ) -> Result<Self::Num>

Source§

fn reserve_factor(&self) -> Result<Self::Num>

Source§

fn open_interest_reserve_factor(&self) -> Result<Self::Num>

Source§

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

Source§

fn ignore_open_interest_for_usage_factor(&self) -> Result<bool>

Implementors§