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

Fields

§market_type: MarketType
§

InvalidInfiniteTakeProfitPrice

Fields

§market_type: MarketType
§

MaxGainsTooLarge

Fields

§

WithdrawTooMuch

Fields

§requested: NonZero<LpToken>
§available: NonZero<LpToken>
§

InsufficientLiquidityForWithdrawal

Fields

§requested_lp: NonZero<LpToken>
§requested_collateral: NonZero<Collateral>
§unlocked: Collateral
§

MissingPosition

Fields

§

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

Fields

§deposit_collateral: Collateral
§deposit_usd: Usd
§minimum_usd: Usd
§

Congestion

Fields

§current_queue: u32
§max_size: u32
§

MaxLiquidity

Fields

§price_collateral_in_usd: PriceCollateralInUsd
§current: Usd
§deposit: Usd
§max: Usd
§

DeltaNeutralityFeeAlreadyLong

Fields

§sensitivity: Signed<Decimal256>
§instant_before: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeAlreadyShort

Fields

§sensitivity: Signed<Decimal256>
§instant_before: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeNewlyLong

Fields

§sensitivity: Signed<Decimal256>
§instant_after: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeNewlyShort

Fields

§sensitivity: Signed<Decimal256>
§instant_after: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeLongToShort

Fields

§sensitivity: Signed<Decimal256>
§instant_before: Signed<Decimal256>
§instant_after: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

DeltaNeutralityFeeShortToLong

Fields

§sensitivity: Signed<Decimal256>
§instant_before: Signed<Decimal256>
§instant_after: Signed<Decimal256>
§net_notional_before: Signed<Notional>
§net_notional_after: Signed<Notional>
§

LiquidityCooldown

Fields

§ends_at: Timestamp
§seconds_remaining: u64
§

PendingDeferredExec

Fields

§

VolatilePriceFeedTimeDelta

Fields

§oldest: Timestamp
§newest: Timestamp
§

LimitOrderAlreadyCanceling

Fields

§order_id: Uint64
§

PositionAlreadyClosing

Fields

§position_id: Uint64
§

NoPricePublishTimeFound

§

PositionAlreadyClosed

Fields

§close_time: Timestamp
§reason: String
§

InsufficientLiquidityForUnlock

Fields

§requested: NonZero<Collateral>
§total_locked: Collateral
§

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

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>

Try to convert from an anyhow::Error.

Trait Implementations§

§

impl Clone for MarketError

§

fn clone(&self) -> MarketError

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for MarketError

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for MarketError

§

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

§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Error for MarketError

1.30.0 · source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
§

impl PartialEq for MarketError

§

fn eq(&self, other: &MarketError) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for MarketError

§

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§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for 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 more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> QueryResultExt for Twhere T: Serialize,

§

fn query_result(&self) -> Result<Binary, Error>

Convert the value to its JSON representation
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,