degenbot.uniswap.v4_pool_calc ============================= .. py:module:: degenbot.uniswap.v4_pool_calc .. autoapi-nested-parse:: Calculation mixin for Uniswap V4 concentrated-liquidity pools. Provides pricing and fee calculation methods that operate on state held by V4PoolState. The swap calculation methods (calculate_tokens_in/out) stay in the pool class because they're tightly coupled to V4-specific internals (SwapDelta, Hooks, HookedPoolResult). See: contract_reference/uniswap/V4/PoolManager.sol (PoolManager swap/modifyLiquidity, Pool, Hooks, SqrtPriceMath, SwapMath) Module Contents --------------- .. py:class:: UniswapV4PoolCalc Pricing and fee methods for Uniswap V4 pools. Class variables that V4 subclasses may override: - FEE_DENOMINATOR .. py:attribute:: tokens :type: tuple[degenbot.erc20.Erc20Token, degenbot.erc20.Erc20Token] .. py:attribute:: state :type: degenbot.uniswap.v4_types.UniswapV4PoolState .. py:attribute:: fee :type: int .. py:attribute:: FEE_DENOMINATOR :value: 1000000 .. py:method:: get_absolute_price(token: degenbot.erc20.Erc20Token, override_state: degenbot.uniswap.v4_types.UniswapV4PoolState | None = None) -> fractions.Fraction Get the absolute price for the given token, expressed in units of the other. :returns: The absolute price as a Fraction. .. py:method:: get_absolute_exchange_rate(token: degenbot.erc20.Erc20Token, override_state: degenbot.uniswap.v4_types.UniswapV4PoolState | None = None) -> fractions.Fraction Get the absolute exchange rate for the given token. :returns: The absolute exchange rate as a Fraction. :raises DegenbotValueError: If the token is not held by this pool. .. py:method:: get_nominal_price(token: degenbot.erc20.Erc20Token, override_state: degenbot.uniswap.v4_types.UniswapV4PoolState | None = None) -> fractions.Fraction Get the nominal price, corrected for decimals. :returns: The nominal price as a Fraction. .. py:method:: get_nominal_exchange_rate(token: degenbot.erc20.Erc20Token, override_state: degenbot.uniswap.v4_types.UniswapV4PoolState | None = None) -> fractions.Fraction Get the nominal rate, corrected for decimal place values. :returns: The nominal exchange rate as a Fraction.