degenbot.uniswap.v4_snapshot ============================ .. py:module:: degenbot.uniswap.v4_snapshot .. autoapi-nested-parse:: Uniswap V4 pool snapshot and subscription handler. Module Contents --------------- .. py:type:: PoolId :canonical: str .. py:type:: PoolManagerAddress :canonical: ChecksummedAddress .. py:type:: ManagedPoolIdentifier :canonical: tuple[PoolManagerAddress, PoolId] .. py:class:: UniswapV4LiquiditySnapshotSource Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.LiquiditySnapshotSource`, :py:obj:`Protocol` A minimal protocol allowing the UniswapV4LiquiditySnapshot class to retrieve pool data. from a generic source. .. py:method:: get_liquidity_map(pool_manager: degenbot.types.chain.ChecksummedAddress, pool_id: bytes | str) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. .. py:method:: get_pools() -> set[PoolId] Return pools. .. py:class:: MonolithicJsonFileSnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.MonolithicJsonFileSnapshotBase` A pool liquidity source backed by a single JSON file. .. py:method:: get_liquidity_map(pool_manager: degenbot.types.chain.ChecksummedAddress, pool_id: bytes | str) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. :returns: The liquidity map for the pool, or None if the pool is not found. .. py:class:: DatabaseSnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.DatabaseSnapshotBase`\ [\ :py:obj:`ManagedPoolIdentifier`\ ] Snapshot source backed by the built-in SQLite database. .. py:method:: get_liquidity_map(pool_manager: degenbot.types.chain.ChecksummedAddress, pool_id: bytes | str) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. :returns: The liquidity map for the pool, or None if not found in the database. .. py:class:: UniswapV4LiquiditySnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.LiquiditySnapshotBase`\ [\ :py:obj:`ManagedPoolIdentifier`\ , :py:obj:`degenbot.uniswap.v4_types.UniswapV4PoolLiquidityMappingUpdate`\ , :py:obj:`degenbot.uniswap.v4_types.UniswapV4LiquidityEvent`\ , :py:obj:`UniswapV4LiquiditySnapshotSource`\ ] Retrieve and maintain liquidity positions for Uniswap V4 pools. .. py:property:: pools :type: set[ManagedPoolIdentifier] Pools. .. py:method:: pending_updates(pool_manager: degenbot.types.chain.HexAddress | bytes, pool_id: degenbot.types.chain.HexStr | bytes) -> tuple[degenbot.uniswap.v4_types.UniswapV4PoolLiquidityMappingUpdate, ...] Consume and return all pending liquidity events for this pool. :returns: Tuple of pending liquidity mapping updates for the pool. .. py:method:: tick_bitmap(pool_manager: degenbot.types.chain.HexAddress | bytes, pool_id: degenbot.types.chain.HexStr | bytes) -> dict[int, degenbot.uniswap.concentrated.types.BitmapAtWord] | None Consume the tick initialization bitmaps for the pool. :returns: The tick bitmap dict, or None if the pool snapshot is unavailable. .. py:method:: tick_data(pool_manager: degenbot.types.chain.HexAddress | bytes, pool_id: degenbot.types.chain.HexStr | bytes) -> dict[int, degenbot.uniswap.concentrated.types.LiquidityAtTick] | None Consume the liquidity mapping for the pool. :returns: The tick data dict, or None if the pool snapshot is unavailable. .. py:method:: update(pool_manager: degenbot.types.chain.HexAddress | bytes, pool_id: degenbot.types.chain.HexStr | bytes, tick_data: dict[int, degenbot.uniswap.concentrated.types.LiquidityAtTick], tick_bitmap: dict[int, degenbot.uniswap.concentrated.types.BitmapAtWord]) -> None Update the liquidity mapping for the pool. :raises UnknownPoolId: If the pool is not found in the snapshot.