pub enum MarketError {
Show 25 variants
InvalidInfiniteMaxGains {
market_type: MarketType,
direction: DirectionToBase,
},
InvalidInfiniteTakeProfitPrice {
market_type: MarketType,
direction: DirectionToBase,
},
MaxGainsTooLarge {},
WithdrawTooMuch {
requested: NonZero<LpToken>,
available: NonZero<LpToken>,
},
InsufficientLiquidityForWithdrawal {
requested_lp: NonZero<LpToken>,
requested_collateral: NonZero<Collateral>,
unlocked: Collateral,
},
MissingPosition {
id: String,
},
TraderLeverageOutOfRange {
low_allowed: Decimal256,
high_allowed: Decimal256,
new_leverage: Decimal256,
current_leverage: Option<Decimal256>,
},
MinimumDeposit {
deposit_collateral: Collateral,
deposit_usd: Usd,
minimum_usd: Usd,
},
Congestion {
current_queue: u32,
max_size: u32,
reason: CongestionReason,
},
MaxLiquidity {
price_collateral_in_usd: PriceCollateralInUsd,
current: Usd,
deposit: Usd,
max: Usd,
},
DeltaNeutralityFeeAlreadyLong {
cap: Number,
sensitivity: Number,
instant_before: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeAlreadyShort {
cap: Number,
sensitivity: Number,
instant_before: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeNewlyLong {
cap: Number,
sensitivity: Number,
instant_after: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeNewlyShort {
cap: Number,
sensitivity: Number,
instant_after: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeLongToShort {
cap: Number,
sensitivity: Number,
instant_before: Number,
instant_after: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeShortToLong {
cap: Number,
sensitivity: Number,
instant_before: Number,
instant_after: Number,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
LiquidityCooldown {
ends_at: Timestamp,
seconds_remaining: u64,
},
PendingDeferredExec {},
VolatilePriceFeedTimeDelta {
oldest: Timestamp,
newest: Timestamp,
},
LimitOrderAlreadyCanceling {
order_id: Uint64,
},
PositionAlreadyClosing {
position_id: Uint64,
},
NoPricePublishTimeFound,
PositionAlreadyClosed {
id: Uint64,
close_time: Timestamp,
reason: String,
},
InsufficientLiquidityForUnlock {
requested: NonZero<Collateral>,
total_locked: Collateral,
},
Liquidity {
requested: NonZero<Collateral>,
total_unlocked: Collateral,
allowed: Collateral,
},
}
Expand description
An error type for known market errors with potentially special error handling.
Variants§
InvalidInfiniteMaxGains
InvalidInfiniteTakeProfitPrice
MaxGainsTooLarge
WithdrawTooMuch
InsufficientLiquidityForWithdrawal
MissingPosition
TraderLeverageOutOfRange
Fields
§
low_allowed: Decimal256
§
high_allowed: Decimal256
§
new_leverage: Decimal256
§
current_leverage: Option<Decimal256>
MinimumDeposit
Congestion
MaxLiquidity
DeltaNeutralityFeeAlreadyLong
Fields
DeltaNeutralityFeeAlreadyShort
Fields
DeltaNeutralityFeeNewlyLong
Fields
DeltaNeutralityFeeNewlyShort
Fields
DeltaNeutralityFeeLongToShort
Fields
DeltaNeutralityFeeShortToLong
Fields
LiquidityCooldown
PendingDeferredExec
VolatilePriceFeedTimeDelta
LimitOrderAlreadyCanceling
PositionAlreadyClosing
NoPricePublishTimeFound
PositionAlreadyClosed
InsufficientLiquidityForUnlock
Liquidity
Fields
§
requested: NonZero<Collateral>
Total amount of liquidity requested to take from unlocked pool.
§
total_unlocked: Collateral
Total amount of liquidity available in the unlocked pool.
§
allowed: Collateral
Liquidity allowed to be taken for this action.
In particular, carry leverage may restrict the total amount of liquidity that can be used to ensure sufficient funds for cash-and-carry balancing operations.
Implementations§
source§impl MarketError
impl MarketError
sourcepub fn into_anyhow(self) -> Error
pub fn into_anyhow(self) -> Error
Convert into an anyhow::Error
.
This method will first convert into a PerpError
and then wrap that
in anyhow::Error
.
sourcepub fn try_from_anyhow(err: &Error) -> Result<Self>
pub fn try_from_anyhow(err: &Error) -> Result<Self>
Try to convert from an anyhow::Error
.
Trait Implementations§
source§impl Clone for MarketError
impl Clone for MarketError
source§fn clone(&self) -> MarketError
fn clone(&self) -> MarketError
Returns a copy 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 Debug for MarketError
impl Debug for MarketError
source§impl<'de> Deserialize<'de> for MarketError
impl<'de> Deserialize<'de> for MarketError
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for MarketError
impl Display for MarketError
source§impl Error for MarketError
impl Error for MarketError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl PartialEq for MarketError
impl PartialEq for MarketError
source§fn eq(&self, other: &MarketError) -> bool
fn eq(&self, other: &MarketError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for MarketError
impl Serialize for MarketError
impl Eq for MarketError
impl StructuralPartialEq for MarketError
Auto Trait Implementations§
impl Freeze for MarketError
impl RefUnwindSafe for MarketError
impl Send for MarketError
impl Sync for MarketError
impl Unpin for MarketError
impl UnwindSafe for MarketError
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> QueryResultExt for Twhere
T: Serialize,
impl<T> QueryResultExt for Twhere
T: Serialize,
source§fn query_result(&self) -> Result<Binary, Error>
fn query_result(&self) -> Result<Binary, Error>
Convert the value to its JSON representation