degenbot.exceptions.arbitrage ============================= .. py:module:: degenbot.exceptions.arbitrage .. autoapi-nested-parse:: Arbitrage-specific exceptions (solver, encoding, incompatible invariant). Module Contents --------------- .. py:class:: ArbitrageError Bases: :py:obj:`degenbot.exceptions.base.DegenbotError` Exception raised inside arbitrage helpers. .. py:class:: ArbCalculationError Bases: :py:obj:`ArbitrageError` Raised when an arbitrage calculation fails. .. py:class:: RateOfExchangeBelowMinimum(rate: fractions.Fraction) Bases: :py:obj:`ArbitrageError` The rate of exchange for the path is below the minimum. .. py:attribute:: rate .. py:class:: InvalidSwapPathError Bases: :py:obj:`ArbitrageError` Raised in arbitrage helper constructors when the provided path is invalid. .. py:class:: DirectionResolutionError Bases: :py:obj:`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. .. py:class:: PathRejectedError Bases: :py:obj:`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. .. py:class:: TokenDenylistedError(*, token: str) Bases: :py:obj:`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. .. py:attribute:: token .. py:class:: HopCountExceededError(*, hop_count: int, max_hops: int) Bases: :py:obj:`PathRejectedError` The path exceeds the configured maximum hop count. .. py:attribute:: hop_count .. py:attribute:: max_hops .. py:class:: HopCountInsufficientError(*, hop_count: int, min_hops: int) Bases: :py:obj:`PathRejectedError` The path is below the configured minimum hop count. .. py:attribute:: hop_count .. py:attribute:: min_hops .. py:class:: InsufficientLiquidityError(*, liquidity: int, min_liquidity: int) Bases: :py:obj:`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). .. py:attribute:: liquidity .. py:attribute:: min_liquidity .. py:class:: DuplicatePoolError(*, pool: str) Bases: :py:obj:`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. .. py:attribute:: pool .. py:class:: NoLiquidity Bases: :py:obj:`ArbitrageError` Raised if a pool has no liquidity for the requested operation. .. py:class:: InvalidForwardAmount Bases: :py:obj:`ArbitrageError` InvalidForwardAmount class. .. py:class:: IncompatiblePoolInvariant Bases: :py:obj:`ArbitrageError` Raised when a pool's invariant type is not supported for. arbitrage path construction (e.g. Aerodrome stable pools). .. py:class:: Unprofitable Bases: :py:obj:`ArbitrageError` Unprofitable class. .. py:class:: NoSolverSolution(message: str = 'Solver failed to converge on a solution.') Bases: :py:obj:`ArbitrageError` NoSolverSolution class. .. py:attribute:: message :value: 'Solver failed to converge on a solution.' .. py:class:: OptimizationError(message: str, *, iterations: int = 0, method: str | None = None) Bases: :py:obj:`ArbitrageError` Raised when a solver fails to find a profitable solution,. fails to converge, or receives invalid inputs. .. attribute:: message Human-readable error message explaining why optimization failed. :type: str .. attribute:: iterations Number of iterations completed before failure (if applicable). :type: int .. attribute:: method The solver method that was attempted (if applicable). :type: str | None .. py:attribute:: message .. py:attribute:: iterations :value: 0 .. py:attribute:: method :value: None