pub trait BalanceExt: Balance {
// Provided methods
fn long_usd_value(&self, price: &Self::Num) -> Result<Self::Num> { ... }
fn short_usd_value(&self, price: &Self::Num) -> Result<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>> { ... }
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 merge<B: Balance>(&self, short: B) -> Merged<&Self, B> { ... }
fn amount(&self, is_long: bool) -> Result<Self::Num> { ... }
}
Expand description
Extension trait for Balance
with utils.
Provided Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.