pub enum MarketError {
Show 26 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>,
},
CounterLeverageOutOfRange {
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: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_before: Signed<Decimal256>,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeAlreadyShort {
cap: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_before: Signed<Decimal256>,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeNewlyLong {
cap: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_after: Signed<Decimal256>,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeNewlyShort {
cap: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_after: Signed<Decimal256>,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeLongToShort {
cap: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_before: Signed<Decimal256>,
instant_after: Signed<Decimal256>,
net_notional_before: Signed<Notional>,
net_notional_after: Signed<Notional>,
},
DeltaNeutralityFeeShortToLong {
cap: Signed<Decimal256>,
sensitivity: Signed<Decimal256>,
instant_before: Signed<Decimal256>,
instant_after: Signed<Decimal256>,
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
Fields
WithdrawTooMuch
InsufficientLiquidityForWithdrawal
MissingPosition
TraderLeverageOutOfRange
Fields
§
low_allowed: Decimal256
§
high_allowed: Decimal256
§
new_leverage: Decimal256
§
current_leverage: Option<Decimal256>
CounterLeverageOutOfRange
Fields
§
low_allowed: Decimal256
§
high_allowed: Decimal256
§
new_leverage: Decimal256
§
current_leverage: Option<Decimal256>
MinimumDeposit
Congestion
MaxLiquidity
DeltaNeutralityFeeAlreadyLong
DeltaNeutralityFeeAlreadyShort
DeltaNeutralityFeeNewlyLong
DeltaNeutralityFeeNewlyShort
DeltaNeutralityFeeLongToShort
Fields
§
cap: Signed<Decimal256>
§
sensitivity: Signed<Decimal256>
§
instant_before: Signed<Decimal256>
§
instant_after: Signed<Decimal256>
DeltaNeutralityFeeShortToLong
Fields
§
cap: Signed<Decimal256>
§
sensitivity: Signed<Decimal256>
§
instant_before: Signed<Decimal256>
§
instant_after: Signed<Decimal256>
LiquidityCooldown
PendingDeferredExec
Fields
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§
§impl MarketError
impl MarketError
pub 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
.
pub fn try_from_anyhow(err: &Error) -> Result<MarketError, Error>
pub fn try_from_anyhow(err: &Error) -> Result<MarketError, Error>
Try to convert from an anyhow::Error
.
Trait Implementations§
§impl Clone for MarketError
impl Clone for MarketError
§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 more§impl Debug for MarketError
impl Debug for MarketError
§impl<'de> Deserialize<'de> for MarketError
impl<'de> Deserialize<'de> for MarketError
§fn deserialize<__D>(
__deserializer: __D
) -> Result<MarketError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<MarketError, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for MarketError
impl Display for MarketError
§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()
§impl PartialEq for MarketError
impl PartialEq for MarketError
§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 ==
.§impl Serialize for MarketError
impl Serialize for MarketError
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for MarketError
impl StructuralEq for MarketError
impl StructuralPartialEq for MarketError
Auto Trait Implementations§
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
§impl<T> QueryResultExt for Twhere
T: Serialize,
impl<T> QueryResultExt for Twhere T: Serialize,
§fn query_result(&self) -> Result<Binary, Error>
fn query_result(&self) -> Result<Binary, Error>
Convert the value to its JSON representation