pub struct TestPool<T> { /* private fields */ }Available on crate features
test only.Expand description
Test Pool.
Trait Implementations§
Source§impl<T> Balance for TestPool<T>
impl<T> Balance for TestPool<T>
Source§fn long_amount(&self) -> Result<Self::Num>
fn long_amount(&self) -> Result<Self::Num>
Get the long token amount (when this is a token balance), or long usd value (when this is a usd value balance).
Source§fn short_amount(&self) -> Result<Self::Num>
fn short_amount(&self) -> Result<Self::Num>
Get the short token amount (when this is a token balance), or short usd value (when this is a usd value balance).
Source§impl<T> Pool for TestPool<T>
impl<T> Pool for TestPool<T>
Source§fn checked_apply_delta(&self, delta: Delta<&Self::Signed>) -> Result<Self>
fn checked_apply_delta(&self, delta: Delta<&Self::Signed>) -> Result<Self>
Checked apply delta amounts.
Source§fn apply_delta_to_long_amount(
&mut self,
delta: &Self::Signed,
) -> Result<(), Error>
fn apply_delta_to_long_amount( &mut self, delta: &Self::Signed, ) -> Result<(), Error>
Apply delta to long amount.
Source§fn apply_delta_to_short_amount(
&mut self,
delta: &Self::Signed,
) -> Result<(), Error>
fn apply_delta_to_short_amount( &mut self, delta: &Self::Signed, ) -> Result<(), Error>
Apply delta to short amount.
Source§fn checked_cancel_amounts(&self) -> Result<Self>where
Self::Signed: CheckedSub,
fn checked_cancel_amounts(&self) -> Result<Self>where
Self::Signed: CheckedSub,
Cancel the amounts, for example, (1000, 200) -> (800, 0). Read more
impl<T: Copy> Copy for TestPool<T>
impl<T: Eq> Eq for TestPool<T>
impl<T> StructuralPartialEq for TestPool<T>
Auto Trait Implementations§
impl<T> Freeze for TestPool<T>where
T: Freeze,
impl<T> RefUnwindSafe for TestPool<T>where
T: RefUnwindSafe,
impl<T> Send for TestPool<T>where
T: Send,
impl<T> Sync for TestPool<T>where
T: Sync,
impl<T> Unpin for TestPool<T>where
T: Unpin,
impl<T> UnwindSafe for TestPool<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<P> BalanceExt for P
impl<P> BalanceExt for P
Source§fn long_usd_value(&self, price: &Self::Num) -> Result<Self::Num>
fn long_usd_value(&self, price: &Self::Num) -> Result<Self::Num>
Get the long amount value in USD.
Source§fn short_usd_value(&self, price: &Self::Num) -> Result<Self::Num>
fn short_usd_value(&self, price: &Self::Num) -> Result<Self::Num>
Get the short amount value in USD.
Source§fn pool_delta_with_amounts(
&self,
long_token_delta_amount: &Self::Signed,
short_token_delta_amount: &Self::Signed,
long_token_price: &Self::Num,
short_token_price: &Self::Num,
) -> Result<PoolDelta<Self::Num>>
fn pool_delta_with_amounts( &self, long_token_delta_amount: &Self::Signed, short_token_delta_amount: &Self::Signed, long_token_price: &Self::Num, short_token_price: &Self::Num, ) -> Result<PoolDelta<Self::Num>>
Get pool value information after applying delta.
Source§fn pool_delta_with_values(
&self,
delta_long_token_usd_value: Self::Signed,
delta_short_token_usd_value: Self::Signed,
long_token_price: &Self::Num,
short_token_price: &Self::Num,
) -> Result<PoolDelta<Self::Num>>
fn pool_delta_with_values( &self, delta_long_token_usd_value: Self::Signed, delta_short_token_usd_value: Self::Signed, long_token_price: &Self::Num, short_token_price: &Self::Num, ) -> Result<PoolDelta<Self::Num>>
Get pool value information after applying delta.
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