Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[non_exhaustive]
pub enum ErrorCode {
Show 54 variants UnknownError, UnsupportedMessage, InvalidRequest, TimeoutError, EntityNotFound, CantRouteRequest, FrameTooLong, MarketClosed, ConcurrentModification, BlockedPayloadType, OaAuthTokenExpired, AccountNotAuthorized, RetNoSuchLogin, AlreadyLoggedIn, RetAccountDisabled, ChClientAuthFailure, ChClientNotAuthenticated, ChClientAlreadyAuthenticated, ChAccessTokenInvalid, ChServerNotReachable, ChCtidTraderAccountNotFound, ChOaClientNotFound, RequestFrequencyExceeded, ServerIsUnderMaintenance, ChannelIsBlocked, ConnectionsLimitExceeded, WorseGslNotAllowed, SymbolHasHoliday, NotSubscribedToSpots, AlreadySubscribed, SymbolNotFound, UnknownSymbol, IncorrectBoundaries, NoQuotes, NotEnoughMoney, MaxExposureReached, PositionNotFound, OrderNotFound, PositionNotOpen, PositionLocked, TooManyPositions, TradingBadVolume, TradingBadStops, TradingBadPrices, TradingBadStake, ProtectionIsTooCloseToMarket, TradingBadExpirationDate, PendingExecution, TradingDisabled, TradingNotAllowed, UnableToCancelOrder, UnableToAmendOrder, ShortSellingNotAllowed, Unknown(String),
}
Expand description

Error code reported by the server.

The server sends the code as text. Every code named in the proto files has a variant; any other text is kept in ErrorCode::Unknown exactly as received.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UnknownError

The server failed for a reason it does not disclose.

§

UnsupportedMessage

The message type is not supported.

§

InvalidRequest

The request is malformed or carries invalid values.

§

TimeoutError

The server did not process the request in time.

§

EntityNotFound

The entity named by the request does not exist.

§

CantRouteRequest

The server could not route the request.

§

FrameTooLong

The frame exceeds the size limit.

§

MarketClosed

The market is closed.

§

ConcurrentModification

The entity was changed by another request at the same time.

§

BlockedPayloadType

The payload type is blocked.

§

OaAuthTokenExpired

The access token has expired.

§

AccountNotAuthorized

The account is not authorised on this connection.

§

RetNoSuchLogin

No account has this login.

§

AlreadyLoggedIn

The account is already authorised on this connection.

§

RetAccountDisabled

The account is disabled.

§

ChClientAuthFailure

The application credentials were refused.

§

ChClientNotAuthenticated

The application is not authorised on this connection.

§

ChClientAlreadyAuthenticated

The application is already authorised on this connection.

§

ChAccessTokenInvalid

The access token is invalid.

§

ChServerNotReachable

The trading server is not reachable.

§

ChCtidTraderAccountNotFound

The trading account was not found.

§

ChOaClientNotFound

The application was not found.

§

RequestFrequencyExceeded

Requests are sent more often than the limit allows.

§

ServerIsUnderMaintenance

The server is under maintenance.

§

ChannelIsBlocked

The channel is blocked.

§

ConnectionsLimitExceeded

The limit of open connections is reached.

§

WorseGslNotAllowed

A guaranteed stop loss may not be moved to a worse level.

§

SymbolHasHoliday

Trading is suspended because the symbol has a holiday.

§

NotSubscribedToSpots

The connection is not subscribed to spot prices of the symbol.

§

AlreadySubscribed

The subscription already exists.

§

SymbolNotFound

The symbol was not found.

§

UnknownSymbol

The symbol is not known to the server.

§

IncorrectBoundaries

The requested time range is not valid.

§

NoQuotes

There are no quotes to trade on.

§

NotEnoughMoney

The account lacks the funds for the trade.

§

MaxExposureReached

The exposure limit is reached.

§

PositionNotFound

The position was not found.

§

OrderNotFound

The order was not found.

§

PositionNotOpen

The position is not open.

§

PositionLocked

The position is locked.

§

TooManyPositions

The limit of open positions is reached.

§

TradingBadVolume

The volume is not valid.

§

TradingBadStops

The stop levels are not valid.

§

TradingBadPrices

The prices are not valid.

§

TradingBadStake

The stake is not valid.

§

ProtectionIsTooCloseToMarket

The protection level is too close to the market price.

§

TradingBadExpirationDate

The expiration date is not valid.

§

PendingExecution

The position has an execution pending.

§

TradingDisabled

Trading is disabled for the symbol.

§

TradingNotAllowed

The account may not trade.

§

UnableToCancelOrder

The order cannot be cancelled.

§

UnableToAmendOrder

The order cannot be amended.

§

ShortSellingNotAllowed

Short selling is not allowed.

§

Unknown(String)

A code this version of the library does not name, kept as received.

Implementations§

Source§

impl ErrorCode

Source

pub fn from_wire(text: &str) -> Self

Maps the text sent by the server to a code.

Source

pub fn as_str(&self) -> &str

Returns the text the server uses for the code.

Source§

impl ErrorCode

Source

pub const fn is_known(&self) -> bool

Tells whether the code is one the proto files name.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorCode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for ErrorCode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ErrorCode

Source§

impl From<&str> for ErrorCode

Source§

fn from(text: &str) -> Self

Converts to this type from the input type.
Source§

impl From<ProtoErrorCode> for ErrorCode

Source§

fn from(code: ProtoErrorCode) -> Self

Converts to this type from the input type.
Source§

impl From<ProtoOaErrorCode> for ErrorCode

Source§

fn from(code: ProtoOaErrorCode) -> Self

Converts to this type from the input type.
Source§

impl Hash for ErrorCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorCode

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more