pub type UnindexedApiError = ApiError<AssetNameExchange, InstrumentNameExchange>;Expand description
Type alias for a ApiError that is keyed on AssetNameExchange and
InstrumentNameExchange (yet to be indexed).
Aliased Type§
pub enum UnindexedApiError {
AssetInvalid(AssetNameExchange, String),
InstrumentInvalid(InstrumentNameExchange, String),
RateLimit,
Unauthenticated(String),
BalanceInsufficient(AssetNameExchange, String),
OrderRejected(String),
OrderAlreadyCancelled,
OrderAlreadyFullyFilled,
}Variants§
AssetInvalid(AssetNameExchange, String)
Provided asset identifier is invalid or not supported.
For example:
- The
AssetNameExchangewas an invalid format.
Not transient — do not retry. The asset identifier must be corrected.
InstrumentInvalid(InstrumentNameExchange, String)
Provided instrument identifier is invalid or not supported.
For example:
- The exchange does not have a market for an instrument.
- The
InstrumentNameExchangewas an invalid format.
Not transient — do not retry. The instrument identifier must be corrected.
RateLimit
Request was rejected due to rate limiting.
The exchange enforces request quotas and the caller has exceeded them.
Some exchanges provide a Retry-After header or similar hint; the client
may incorporate this into internal retry logic before surfacing this error.
Transient — retry with backoff. Typical backoff is 10-60 seconds, but respect exchange-specific guidance if available.
Unauthenticated(String)
Authentication failed (invalid credentials, expired key, bad signature).
Unlike other API errors which affect a single request, authentication failures indicate that all subsequent requests will fail until credentials are corrected. Callers should halt trading and alert operators.
Not transient — do not retry. Fix credentials and restart.
BalanceInsufficient(AssetNameExchange, String)
Balance of an asset is insufficient to execute the requested operation.
§Warning: AssetKey field may hold an instrument name, not an asset name
Some ExecutionClient implementations (e.g. BinanceSpot) populate the
AssetKey field with the instrument name (e.g. "BTCUSDT") rather than
the specific low-balance asset (e.g. "BTC" or "USDT"), because splitting
a symbol into base/quote requires exchange symbol-info metadata not available
at error-parse time. Do not pattern-match on the AssetKey value to
identify the specific low-balance asset — use the String field for
diagnostics only.
Not transient — do not retry the same request. Reduce order size or deposit additional funds.
OrderRejected(String)
Order was rejected by the exchange for a business rule violation.
Common causes include: price outside allowed range, quantity below minimum, post-only order would cross, reduce-only with no position.
Not transient — do not retry the same request. Adjust order parameters.
OrderAlreadyCancelled
Cancel request failed because the order was already cancelled.
This is a state conflict, not an error per se — the desired end state (order cancelled) has already been achieved.
Not transient — do not retry. The order is already in the cancelled state.
OrderAlreadyFullyFilled
Cancel request failed because the order was already fully filled.
This is a state conflict — the order completed before the cancel arrived. The caller should reconcile their local state with the fill.
Not transient — do not retry. The order no longer exists to cancel.