pub struct TestMarket<T: Unsigned, const DECIMALS: u8> { /* private fields */ }Available on crate features
test only.Expand description
Test Market.
Implementations§
Source§impl<T: Unsigned, const DECIMALS: u8> TestMarket<T, DECIMALS>
impl<T: Unsigned, const DECIMALS: u8> TestMarket<T, DECIMALS>
Sourcepub fn move_clock_forward(&mut self, duration: Duration)
pub fn move_clock_forward(&mut self, duration: Duration)
Move the clock forward.
Source§impl TestMarket<u64, 9>
impl TestMarket<u64, 9>
Sourcepub fn with_config(config: TestMarketConfig<u64, 9>) -> Self
pub fn with_config(config: TestMarketConfig<u64, 9>) -> Self
Create a new TestMarket with config.
Source§impl TestMarket<u128, 20>
impl TestMarket<u128, 20>
Sourcepub fn with_config(config: TestMarketConfig<u128, 20>) -> Self
Available on crate feature u128 only.
pub fn with_config(config: TestMarketConfig<u128, 20>) -> Self
u128 only.Create a new TestMarket with config.
Trait Implementations§
Source§impl<T, const DECIMALS: u8> BaseMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> BaseMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn liquidity_pool(&self) -> Result<&Self::Pool>
fn liquidity_pool(&self) -> Result<&Self::Pool>
Get the liquidity pool.
Source§fn claimable_fee_pool(&self) -> Result<&Self::Pool>
fn claimable_fee_pool(&self) -> Result<&Self::Pool>
Get the claimable fee pool.
Source§fn swap_impact_pool(&self) -> Result<&Self::Pool>
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>
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>
fn open_interest_in_tokens_pool(&self, is_long: bool) -> Result<&Self::Pool>
Get the open interest in (index) tokens pool.
Source§fn virtual_inventory_for_swaps_pool(
&self,
) -> Result<Option<impl Deref<Target = Self::Pool>>>
fn virtual_inventory_for_swaps_pool( &self, ) -> Result<Option<impl Deref<Target = Self::Pool>>>
Get virtual inventory for swaps.
Source§fn virtual_inventory_for_positions_pool(
&self,
) -> Result<Option<impl Deref<Target = Self::Pool>>>
fn virtual_inventory_for_positions_pool( &self, ) -> Result<Option<impl Deref<Target = Self::Pool>>>
Get virtual inventory for positions.
Source§fn usd_to_amount_divisor(&self) -> Self::Num
fn usd_to_amount_divisor(&self) -> Self::Num
USD value to market token amount divisor. Read more
Source§fn 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.
Source§fn reserve_factor(&self) -> Result<Self::Num>
fn reserve_factor(&self) -> Result<Self::Num>
Get reserve factor.
Source§fn open_interest_reserve_factor(&self) -> Result<Self::Num>
fn open_interest_reserve_factor(&self) -> Result<Self::Num>
Get open interest reserve factor.
Source§fn 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.
Source§impl<T, const DECIMALS: u8> BaseMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> BaseMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Source§impl<T, const DECIMALS: u8> BorrowingFeeMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> BorrowingFeeMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn borrowing_fee_params(&self) -> Result<BorrowingFeeParams<Self::Num>>
fn borrowing_fee_params(&self) -> Result<BorrowingFeeParams<Self::Num>>
Get borrowing fee params.
Source§fn borrowing_factor_pool(&self) -> Result<&Self::Pool>
fn borrowing_factor_pool(&self) -> Result<&Self::Pool>
Get borrowing factor pool.
Source§fn total_borrowing_pool(&self) -> Result<&Self::Pool>
fn total_borrowing_pool(&self) -> Result<&Self::Pool>
Get total borrowing pool.
Source§fn passed_in_seconds_for_borrowing(&self) -> Result<u64>
fn passed_in_seconds_for_borrowing(&self) -> Result<u64>
Get the passed time in seconds for the given kind of clock.
Source§fn borrowing_fee_kink_model_params(
&self,
) -> Result<BorrowingFeeKinkModelParams<Self::Num>>
fn borrowing_fee_kink_model_params( &self, ) -> Result<BorrowingFeeKinkModelParams<Self::Num>>
Get borrowing fee kink model params.
Source§impl<T, const DECIMALS: u8> BorrowingFeeMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> BorrowingFeeMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Source§impl<T: Clone + Unsigned, const DECIMALS: u8> Clone for TestMarket<T, DECIMALS>
impl<T: Clone + Unsigned, const DECIMALS: u8> Clone for TestMarket<T, DECIMALS>
Source§fn clone(&self) -> TestMarket<T, DECIMALS>
fn clone(&self) -> TestMarket<T, DECIMALS>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for TestMarket<u128, 20>
Available on crate feature u128 only.
impl Default for TestMarket<u128, 20>
Available on crate feature
u128 only.Source§impl Default for TestMarket<u64, 9>
impl Default for TestMarket<u64, 9>
Source§impl<T, const DECIMALS: u8> LiquidityMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> LiquidityMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn total_supply(&self) -> Self::Num
fn total_supply(&self) -> Self::Num
Get total supply of the market token.
Source§impl<T, const DECIMALS: u8> LiquidityMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> LiquidityMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Source§impl<T, const DECIMALS: u8> PerpMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> PerpMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn funding_factor_per_second(&self) -> &Self::Signed
fn funding_factor_per_second(&self) -> &Self::Signed
Get funding factor per second.
Source§fn funding_amount_per_size_adjustment(&self) -> Self::Num
fn funding_amount_per_size_adjustment(&self) -> Self::Num
Adjustment factor for packing funding amount per size.
Source§fn funding_fee_params(&self) -> Result<FundingFeeParams<Self::Num>>
fn funding_fee_params(&self) -> Result<FundingFeeParams<Self::Num>>
Get funding fee params.
Source§fn funding_amount_per_size_pool(&self, is_long: bool) -> Result<&Self::Pool>
fn funding_amount_per_size_pool(&self, is_long: bool) -> Result<&Self::Pool>
Get funding amount per size pool.
Source§fn claimable_funding_amount_per_size_pool(
&self,
is_long: bool,
) -> Result<&Self::Pool>
fn claimable_funding_amount_per_size_pool( &self, is_long: bool, ) -> Result<&Self::Pool>
Get claimable funding amount per size pool.
Source§fn position_params(&self) -> Result<PositionParams<Self::Num>>
fn position_params(&self) -> Result<PositionParams<Self::Num>>
Get basic position params.
Source§fn min_collateral_factor_for_open_interest_multiplier(
&self,
_is_long: bool,
) -> Result<Self::Num>
fn min_collateral_factor_for_open_interest_multiplier( &self, _is_long: bool, ) -> Result<Self::Num>
Get min collateral factor for open interest multiplier.
Source§fn liquidation_fee_params(&self) -> Result<LiquidationFeeParams<Self::Num>>
fn liquidation_fee_params(&self) -> Result<LiquidationFeeParams<Self::Num>>
Get liquidation fee params.
Source§impl<T, const DECIMALS: u8> PerpMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> PerpMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn funding_factor_per_second_mut(&mut self) -> &mut Self::Signed
fn funding_factor_per_second_mut(&mut self) -> &mut Self::Signed
Get funding factor per second mutably.
Source§fn open_interest_pool_mut(&mut self, is_long: bool) -> Result<&mut Self::Pool>
fn open_interest_pool_mut(&mut self, is_long: bool) -> Result<&mut Self::Pool>
Get mutable reference of open interest pool. Read more
Source§fn open_interest_in_tokens_pool_mut(
&mut self,
is_long: bool,
) -> Result<&mut Self::Pool>
fn open_interest_in_tokens_pool_mut( &mut self, is_long: bool, ) -> Result<&mut Self::Pool>
Get mutable reference of open interest pool. Read more
Source§fn funding_amount_per_size_pool_mut(
&mut self,
is_long: bool,
) -> Result<&mut Self::Pool>
fn funding_amount_per_size_pool_mut( &mut self, is_long: bool, ) -> Result<&mut Self::Pool>
Get funding amount per size pool mutably. Read more
Source§fn claimable_funding_amount_per_size_pool_mut(
&mut self,
is_long: bool,
) -> Result<&mut Self::Pool>
fn claimable_funding_amount_per_size_pool_mut( &mut self, is_long: bool, ) -> Result<&mut Self::Pool>
Get claimable funding amount per size pool mutably. Read more
Source§fn collateral_sum_pool_mut(&mut self, is_long: bool) -> Result<&mut Self::Pool>
fn collateral_sum_pool_mut(&mut self, is_long: bool) -> Result<&mut Self::Pool>
Get collateral sum pool mutably. Read more
Source§fn total_borrowing_pool_mut(&mut self) -> Result<&mut Self::Pool>
fn total_borrowing_pool_mut(&mut self) -> Result<&mut Self::Pool>
Get total borrowing pool mutably. Read more
Source§fn virtual_inventory_for_positions_pool_mut(
&mut self,
) -> Result<Option<impl DerefMut<Target = Self::Pool>>>
fn virtual_inventory_for_positions_pool_mut( &mut self, ) -> Result<Option<impl DerefMut<Target = Self::Pool>>>
Get virtual inventory for positions mutably. Read more
Source§fn just_passed_in_seconds_for_funding(&mut self) -> Result<u64>
fn just_passed_in_seconds_for_funding(&mut self) -> Result<u64>
Get the just passed time in seconds for the given kind of clock.
Source§impl<T, const DECIMALS: u8> PositionImpactMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> PositionImpactMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn position_impact_pool(&self) -> Result<&Self::Pool>
fn position_impact_pool(&self) -> Result<&Self::Pool>
Get position impact pool.
Source§fn position_impact_params(&self) -> Result<PriceImpactParams<Self::Num>>
fn position_impact_params(&self) -> Result<PriceImpactParams<Self::Num>>
Get the position impact params.
Source§fn position_impact_distribution_params(
&self,
) -> Result<PositionImpactDistributionParams<Self::Num>>
fn position_impact_distribution_params( &self, ) -> Result<PositionImpactDistributionParams<Self::Num>>
Get position impact distribution params.
Source§fn passed_in_seconds_for_position_impact_distribution(&self) -> Result<u64>
fn passed_in_seconds_for_position_impact_distribution(&self) -> Result<u64>
Get the passed time in seconds for the given kind of clock.
Source§impl<T, const DECIMALS: u8> PositionImpactMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> PositionImpactMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Source§impl<T, const DECIMALS: u8> SwapMarket<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> SwapMarket<DECIMALS> for TestMarket<T, DECIMALS>
Source§fn swap_impact_params(&self) -> Result<PriceImpactParams<Self::Num>>
fn swap_impact_params(&self) -> Result<PriceImpactParams<Self::Num>>
Get swap impact params.
Source§impl<T, const DECIMALS: u8> SwapMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> SwapMarketMut<DECIMALS> for TestMarket<T, DECIMALS>
Auto Trait Implementations§
impl<T, const DECIMALS: u8> Freeze for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> RefUnwindSafe for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> Send for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> Sync for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> Unpin for TestMarket<T, DECIMALS>
impl<T, const DECIMALS: u8> UnwindSafe for TestMarket<T, DECIMALS>
Blanket Implementations§
Source§impl<M, const DECIMALS: u8> BaseMarketExt<DECIMALS> for Mwhere
M: BaseMarket<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> BaseMarketExt<DECIMALS> for Mwhere
M: BaseMarket<DECIMALS> + ?Sized,
Source§fn pool_value_without_pnl_for_one_side(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
maximize: bool,
) -> Result<Self::Num>
fn pool_value_without_pnl_for_one_side( &self, prices: &Prices<Self::Num>, is_long: bool, maximize: bool, ) -> Result<Self::Num>
Get the usd value of primary pool without pnl for one side.
Source§fn open_interest(&self) -> Result<Merged<&Self::Pool, &Self::Pool>>
fn open_interest(&self) -> Result<Merged<&Self::Pool, &Self::Pool>>
Get total open interest as a
Balance.Source§fn pnl(
&self,
index_token_price: &Price<Self::Num>,
is_long: bool,
maximize: bool,
) -> Result<Self::Signed>
fn pnl( &self, index_token_price: &Price<Self::Num>, is_long: bool, maximize: bool, ) -> Result<Self::Signed>
Get total pnl of the market for one side.
Source§fn pnl_factor_with_pool_value(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
maximize: bool,
) -> Result<(Self::Signed, Self::Num)>
fn pnl_factor_with_pool_value( &self, prices: &Prices<Self::Num>, is_long: bool, maximize: bool, ) -> Result<(Self::Signed, Self::Num)>
Get pnl factor with pool value.
Source§fn pnl_factor(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
maximize: bool,
) -> Result<Self::Signed>
fn pnl_factor( &self, prices: &Prices<Self::Num>, is_long: bool, maximize: bool, ) -> Result<Self::Signed>
Get pnl factor.
Source§fn validate_pool_amount(&self, is_long_token: bool) -> Result<()>
fn validate_pool_amount(&self, is_long_token: bool) -> Result<()>
Validate (primary) pool amount.
Source§fn pnl_factor_exceeded(
&self,
prices: &Prices<Self::Num>,
kind: PnlFactorKind,
is_long: bool,
) -> Result<Option<PnlFactorExceeded<Self::Num>>>
fn pnl_factor_exceeded( &self, prices: &Prices<Self::Num>, kind: PnlFactorKind, is_long: bool, ) -> Result<Option<PnlFactorExceeded<Self::Num>>>
Get the excess of pending pnl. Read more
Source§fn validate_pnl_factor(
&self,
prices: &Prices<Self::Num>,
kind: PnlFactorKind,
is_long: bool,
) -> Result<()>
fn validate_pnl_factor( &self, prices: &Prices<Self::Num>, kind: PnlFactorKind, is_long: bool, ) -> Result<()>
Validate pnl factor.
Source§fn validate_max_pnl(
&self,
prices: &Prices<Self::Num>,
long_kind: PnlFactorKind,
short_kind: PnlFactorKind,
) -> Result<()>
fn validate_max_pnl( &self, prices: &Prices<Self::Num>, long_kind: PnlFactorKind, short_kind: PnlFactorKind, ) -> Result<()>
Validate max pnl.
Source§fn reserved_value(
&self,
index_token_price: &Price<Self::Num>,
is_long: bool,
) -> Result<Self::Num>
fn reserved_value( &self, index_token_price: &Price<Self::Num>, is_long: bool, ) -> Result<Self::Num>
Get reserved value.
Source§fn validate_reserve(
&self,
prices: &Prices<Self::Num>,
is_long: bool,
) -> Result<()>
fn validate_reserve( &self, prices: &Prices<Self::Num>, is_long: bool, ) -> Result<()>
Validate reserve.
Source§fn expected_min_token_balance_excluding_collateral_amount_for_one_token_side(
&self,
is_long_side: bool,
) -> Result<Self::Num>
fn expected_min_token_balance_excluding_collateral_amount_for_one_token_side( &self, is_long_side: bool, ) -> Result<Self::Num>
Expected min token balance excluding collateral amount. Read more
Source§impl<M, const DECIMALS: u8> BaseMarketMutExt<DECIMALS> for Mwhere
M: BaseMarketMut<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> BaseMarketMutExt<DECIMALS> for Mwhere
M: BaseMarketMut<DECIMALS> + ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<M, const DECIMALS: u8> BorrowingFeeMarketExt<DECIMALS> for Mwhere
M: BorrowingFeeMarket<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> BorrowingFeeMarketExt<DECIMALS> for Mwhere
M: BorrowingFeeMarket<DECIMALS> + ?Sized,
Source§fn cumulative_borrowing_factor(&self, is_long: bool) -> Result<Self::Num>
fn cumulative_borrowing_factor(&self, is_long: bool) -> Result<Self::Num>
Get current borrowing factor.
Source§fn borrowing_factor_per_second(
&self,
is_long: bool,
prices: &Prices<Self::Num>,
) -> Result<Self::Num>
fn borrowing_factor_per_second( &self, is_long: bool, prices: &Prices<Self::Num>, ) -> Result<Self::Num>
Get borrowing factor per second.
Source§impl<M, const DECIMALS: u8> BorrowingFeeMarketMutExt<DECIMALS> for Mwhere
M: BorrowingFeeMarketMut<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> BorrowingFeeMarketMutExt<DECIMALS> for Mwhere
M: BorrowingFeeMarketMut<DECIMALS> + ?Sized,
Source§fn update_borrowing(
&mut self,
prices: &Prices<Self::Num>,
) -> Result<UpdateBorrowingState<&mut Self, DECIMALS>>where
Self: Sized,
fn update_borrowing(
&mut self,
prices: &Prices<Self::Num>,
) -> Result<UpdateBorrowingState<&mut Self, DECIMALS>>where
Self: Sized,
Create a
UpdateBorrowingState action.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<M, const DECIMALS: u8> LiquidityMarketExt<DECIMALS> for Mwhere
M: LiquidityMarket<DECIMALS>,
impl<M, const DECIMALS: u8> LiquidityMarketExt<DECIMALS> for Mwhere
M: LiquidityMarket<DECIMALS>,
Source§fn validate_pool_value_for_deposit(
&self,
prices: &Prices<Self::Num>,
is_long_token: bool,
) -> Result<()>
fn validate_pool_value_for_deposit( &self, prices: &Prices<Self::Num>, is_long_token: bool, ) -> Result<()>
Validate (primary) pool value for deposit.
Source§fn pool_value(
&self,
prices: &Prices<Self::Num>,
pnl_factor: PnlFactorKind,
maximize: bool,
) -> Result<Self::Signed>
fn pool_value( &self, prices: &Prices<Self::Num>, pnl_factor: PnlFactorKind, maximize: bool, ) -> Result<Self::Signed>
Get the usd value of primary pool.
Source§fn market_token_value(
&self,
amount: &Self::Num,
prices: &Prices<Self::Num>,
pnl_factor: PnlFactorKind,
maximize: bool,
) -> Result<Option<MarketTokenValue<Self::Num>>>
fn market_token_value( &self, amount: &Self::Num, prices: &Prices<Self::Num>, pnl_factor: PnlFactorKind, maximize: bool, ) -> Result<Option<MarketTokenValue<Self::Num>>>
Returns the market token value if evaluated, otherwise
None.Source§fn market_token_price(
&self,
prices: &Prices<Self::Num>,
pnl_factor: PnlFactorKind,
maximize: bool,
) -> Result<Self::Num>
fn market_token_price( &self, prices: &Prices<Self::Num>, pnl_factor: PnlFactorKind, maximize: bool, ) -> Result<Self::Num>
Get market token price.
Source§impl<M, const DECIMALS: u8> LiquidityMarketMutExt<DECIMALS> for Mwhere
M: LiquidityMarketMut<DECIMALS>,
impl<M, const DECIMALS: u8> LiquidityMarketMutExt<DECIMALS> for Mwhere
M: LiquidityMarketMut<DECIMALS>,
Source§fn deposit(
&mut self,
long_token_amount: Self::Num,
short_token_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Deposit<&mut Self, DECIMALS>, Error>where
Self: Sized,
fn deposit(
&mut self,
long_token_amount: Self::Num,
short_token_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Deposit<&mut Self, DECIMALS>, Error>where
Self: Sized,
Create a
Deposit action.Source§fn withdraw(
&mut self,
market_token_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Withdrawal<&mut Self, DECIMALS>>where
Self: Sized,
fn withdraw(
&mut self,
market_token_amount: Self::Num,
prices: Prices<Self::Num>,
) -> Result<Withdrawal<&mut Self, DECIMALS>>where
Self: Sized,
Create a
Withdrawal.Source§impl<M, const DECIMALS: u8> PerpMarketExt<DECIMALS> for Mwhere
M: PerpMarket<DECIMALS>,
impl<M, const DECIMALS: u8> PerpMarketExt<DECIMALS> for Mwhere
M: PerpMarket<DECIMALS>,
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§impl<M, const DECIMALS: u8> PerpMarketMutExt<DECIMALS> for Mwhere
M: PerpMarketMut<DECIMALS>,
impl<M, const DECIMALS: u8> PerpMarketMutExt<DECIMALS> for Mwhere
M: PerpMarketMut<DECIMALS>,
Source§fn update_funding(
&mut self,
prices: &Prices<Self::Num>,
) -> Result<UpdateFundingState<&mut Self, DECIMALS>>where
Self: Sized,
fn update_funding(
&mut self,
prices: &Prices<Self::Num>,
) -> Result<UpdateFundingState<&mut Self, DECIMALS>>where
Self: Sized,
Create a
UpdateFundingState action.Source§fn apply_delta_to_funding_amount_per_size(
&mut self,
is_long: bool,
is_long_collateral: bool,
delta: &Self::Signed,
) -> Result<()>
fn apply_delta_to_funding_amount_per_size( &mut self, is_long: bool, is_long_collateral: bool, delta: &Self::Signed, ) -> Result<()>
Apply delta to funding amount per size.
Source§impl<M, const DECIMALS: u8> PositionImpactMarketExt<DECIMALS> for Mwhere
M: PositionImpactMarket<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> PositionImpactMarketExt<DECIMALS> for Mwhere
M: PositionImpactMarket<DECIMALS> + ?Sized,
Source§impl<M, const DECIMALS: u8> PositionImpactMarketMutExt<DECIMALS> for Mwhere
M: PositionImpactMarketMut<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> PositionImpactMarketMutExt<DECIMALS> for Mwhere
M: PositionImpactMarketMut<DECIMALS> + ?Sized,
Source§fn apply_delta_to_position_impact_pool(
&mut self,
delta: &Self::Signed,
) -> Result<()>
fn apply_delta_to_position_impact_pool( &mut self, delta: &Self::Signed, ) -> Result<()>
Apply delta to the position impact pool.
Source§fn distribute_position_impact(
&mut self,
) -> Result<DistributePositionImpact<&mut Self, DECIMALS>>where
Self: Sized,
fn distribute_position_impact(
&mut self,
) -> Result<DistributePositionImpact<&mut Self, DECIMALS>>where
Self: Sized,
Create a
DistributePositionImpact action.Source§impl<M, const DECIMALS: u8> SwapMarketExt<DECIMALS> for Mwhere
M: SwapMarket<DECIMALS> + ?Sized,
impl<M, const DECIMALS: u8> SwapMarketExt<DECIMALS> for Mwhere
M: SwapMarket<DECIMALS> + ?Sized,
Source§fn swap_impact_value(
&self,
liquidity_pool_delta: &PoolDelta<Self::Num>,
include_virtual_inventory_impact: bool,
) -> Result<PriceImpact<Self::Signed>>
fn swap_impact_value( &self, liquidity_pool_delta: &PoolDelta<Self::Num>, include_virtual_inventory_impact: bool, ) -> Result<PriceImpact<Self::Signed>>
Calculate swap price impact.