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§
Sourcetype Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>
type Num: MulDiv<Signed = Self::Signed> + FixedPointOps<DECIMALS>
Unsigned number type used in the market.
Required Methods§
Sourcefn liquidity_pool(&self) -> Result<&Self::Pool>
fn liquidity_pool(&self) -> Result<&Self::Pool>
Get the liquidity pool.
Sourcefn claimable_fee_pool(&self) -> Result<&Self::Pool>
fn claimable_fee_pool(&self) -> Result<&Self::Pool>
Get the claimable fee pool.
Sourcefn swap_impact_pool(&self) -> Result<&Self::Pool>
fn swap_impact_pool(&self) -> Result<&Self::Pool>
Get the swap impact pool.
Sourcefn open_interest_pool(&self, is_long: bool) -> Result<&Self::Pool>
fn open_interest_pool(&self, is_long: bool) -> Result<&Self::Pool>
Get the open interest pool.
Sourcefn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>
fn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>
Get the open interest in (index) tokens pool.
Sourcefn collateral_sum_pool(&self, is_long: bool) -> Result<&Self::Pool>
fn collateral_sum_pool(&self, is_long: bool) -> Result<&Self::Pool>
Get collateral sum pool.
Sourcefn usd_to_amount_divisor(&self) -> Self::Num
fn usd_to_amount_divisor(&self) -> Self::Num
USD value to market token amount divisor.
One should make sure it is non-zero.
Sourcefn max_pool_amount(&self, is_long_token: bool) -> Result<Self::Num>
fn max_pool_amount(&self, is_long_token: bool) -> Result<Self::Num>
Get max pool amount.
Sourcefn pnl_factor_config(
&self,
kind: PnlFactorKind,
is_long: bool,
) -> Result<Self::Num>
fn pnl_factor_config( &self, kind: PnlFactorKind, is_long: bool, ) -> Result<Self::Num>
Get pnl factor config.
Sourcefn reserve_factor(&self) -> Result<Self::Num>
fn reserve_factor(&self) -> Result<Self::Num>
Get reserve factor.
Sourcefn open_interest_reserve_factor(&self) -> Result<Self::Num>
fn open_interest_reserve_factor(&self) -> Result<Self::Num>
Get open interest reserve factor.
Sourcefn max_open_interest(&self, is_long: bool) -> Result<Self::Num>
fn max_open_interest(&self, is_long: bool) -> Result<Self::Num>
Get max open interest.
Sourcefn ignore_open_interest_for_usage_factor(&self) -> Result<bool>
fn ignore_open_interest_for_usage_factor(&self) -> Result<bool>
Returns whether ignore open interest for usage factor.