degenbot.exceptions.arbitrage¶

Arbitrage-specific exceptions (solver, encoding, incompatible invariant).

Module Contents¶

class degenbot.exceptions.arbitrage.ArbitrageError¶

Bases: degenbot.exceptions.base.DegenbotError

Exception raised inside arbitrage helpers.

class degenbot.exceptions.arbitrage.ArbCalculationError¶

Bases: ArbitrageError

Raised when an arbitrage calculation fails.

class degenbot.exceptions.arbitrage.RateOfExchangeBelowMinimum(rate: fractions.Fraction)¶

Bases: ArbitrageError

The rate of exchange for the path is below the minimum.

rate¶
class degenbot.exceptions.arbitrage.InvalidSwapPathError¶

Bases: ArbitrageError

Raised in arbitrage helper constructors when the provided path is invalid.

class degenbot.exceptions.arbitrage.DirectionResolutionError¶

Bases: ArbitrageError

A discovered path’s hop directions could not be resolved to a closed token cycle.

The pathfinder contract guarantees every yielded path starts and ends at one of the requested boundary tokens ({WETH, native}), so a failure here is an invariant violation between the DB subgraph edges and the constructed pool objects (e.g. a pool built with different token0/token1 than the subgraph edge used) — a bug, not a skippable condition.

class degenbot.exceptions.arbitrage.PathRejectedError¶

Bases: ArbitrageError

A path candidate was rejected by a path-composition policy predicate.

Policy rejection is distinct from the Rust core’s pool admission floor (HookedPoolRejectedError / DynamicFeePoolRejectedError, which subclass ValueError). Policy rejects by deployment rule (token denylist/allowlist, hop-count, min-liquidity, duplicate-pool); admission rejects by correctness floor. Callers classify by type so the two hierarchies (ArbitrageError vs ValueError) stay separable.

class degenbot.exceptions.arbitrage.TokenDenylistedError(*, token: str)¶

Bases: PathRejectedError

An intermediate or profit token is not permitted by the policy.

Covers both denylist membership and allowlist absence. token is the checksummed offending token address.

token¶
class degenbot.exceptions.arbitrage.HopCountExceededError(*, hop_count: int, max_hops: int)¶

Bases: PathRejectedError

The path exceeds the configured maximum hop count.

hop_count¶
max_hops¶
class degenbot.exceptions.arbitrage.HopCountInsufficientError(*, hop_count: int, min_hops: int)¶

Bases: PathRejectedError

The path is below the configured minimum hop count.

hop_count¶
min_hops¶
class degenbot.exceptions.arbitrage.InsufficientLiquidityError(*, liquidity: int, min_liquidity: int)¶

Bases: PathRejectedError

A pool’s liquidity proxy is below the configured minimum.

liquidity is the value returned by the caller-supplied liquidity_of extractor (the library does not encode pool-type-specific liquidity math).

liquidity¶
min_liquidity¶
class degenbot.exceptions.arbitrage.DuplicatePoolError(*, pool: str)¶

Bases: PathRejectedError

The same pool appears more than once in the path.

A degenerate, non-executable cycle. V2/V3 pools are keyed by address; V4 pools by pool_id hex. pool is the duplicated pool’s identity key.

pool¶
class degenbot.exceptions.arbitrage.NoLiquidity¶

Bases: ArbitrageError

Raised if a pool has no liquidity for the requested operation.

class degenbot.exceptions.arbitrage.InvalidForwardAmount¶

Bases: ArbitrageError

InvalidForwardAmount class.

class degenbot.exceptions.arbitrage.IncompatiblePoolInvariant¶

Bases: ArbitrageError

Raised when a pool’s invariant type is not supported for.

arbitrage path construction (e.g. Aerodrome stable pools).

class degenbot.exceptions.arbitrage.Unprofitable¶

Bases: ArbitrageError

Unprofitable class.

class degenbot.exceptions.arbitrage.NoSolverSolution(message: str = 'Solver failed to converge on a solution.')¶

Bases: ArbitrageError

NoSolverSolution class.

message = 'Solver failed to converge on a solution.'¶
class degenbot.exceptions.arbitrage.OptimizationError(message: str, *, iterations: int = 0, method: str | None = None)¶

Bases: ArbitrageError

Raised when a solver fails to find a profitable solution,.

fails to converge, or receives invalid inputs.

message¶

Human-readable error message explaining why optimization failed.

Type:

str

iterations¶

Number of iterations completed before failure (if applicable).

Type:

int

method¶

The solver method that was attempted (if applicable).

Type:

str | None

message¶
iterations = 0¶
method = None¶